feat(route): 增加polkaworld的rsshub规则(v2版本scripts) (#9015)
* feat: 增加polkaworld的rsshub规则 * feat: 增加polkaworld的rsshub规则-切换为v2版本 * feat: 增加polkaworld的rsshub规则(修复路径问题) * refactor: added limit support & improve date and docs for polkworld * docs: improve docs desc for polkaworld * refactor: improve docs & clean date code for polkaworld * docs: improve docs for polkaworld * fix: 修复日期解析错误 * fix: fix date error from Vercel's output * feat: 增加时区操作 * style: remove blank line * fix: fix timezone error
This commit is contained in:
@@ -90,6 +90,18 @@ pageClass: routes
|
||||
|
||||
<Route author="CitrusIce" example="/phrack" path="/phrack" />
|
||||
|
||||
## PolkaWorld
|
||||
|
||||
### 最新资讯
|
||||
|
||||
<Route author="iceqing" example="/polkaworld/newest" path="/polkaworld/newest"/>
|
||||
|
||||
::: tip 提示
|
||||
|
||||
在路由末尾处加上 `?limit=限制获取数目` 来限制获取条目数量,默认值为`10`.
|
||||
|
||||
:::
|
||||
|
||||
## Whoscall
|
||||
|
||||
### 最新文章
|
||||
|
||||
@@ -44,6 +44,17 @@ pageClass: routes
|
||||
|
||||
## Phrack Magazine
|
||||
|
||||
## PolkaWorld
|
||||
|
||||
### Newest Articles
|
||||
<RouteEn author="iceqing" example="/polkaworld/newest" path="/polkaworld/newest"/>
|
||||
|
||||
::: tip
|
||||
|
||||
Limit the number of entries to be retrieved by adding `?limit=x` to the end of the route, default value is `10`.
|
||||
|
||||
:::
|
||||
|
||||
### Article
|
||||
|
||||
<RouteEn author="CitrusIce" example="/phrack" path="/phrack" />
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
const got = require('@/utils/got');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const timezone = require('@/utils/timezone');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const limit = ctx.query.limit ? parseInt(ctx.query.limit) : 10;
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: 'https://pub.polkaworld.pro/articles?_sort=PublishDate:desc&_limit=' + limit,
|
||||
});
|
||||
const docList = response.data;
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'PolkaWorld-资讯',
|
||||
link: 'https://www.polkaworld.org/',
|
||||
item: docList.map((item) => ({
|
||||
title: item.Title,
|
||||
description: item.Title,
|
||||
pubDate: timezone(parseDate(item.PublishDate), 0),
|
||||
author: item.author.Name,
|
||||
link: 'https://www.polkaworld.org/articles/' + item.URL,
|
||||
})),
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/polkaworld/newest': ['iceqing'],
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
'polkaworld.org': {
|
||||
_name: 'PolkaWorld',
|
||||
www: [
|
||||
{
|
||||
title: '最新资讯',
|
||||
docs: 'https://docs.rsshub.app/blog.html#polkaworld',
|
||||
source: ['/', '/articles/:name'],
|
||||
target: '/polkaworld/newest',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/newest', require('./home'));
|
||||
};
|
||||
Reference in New Issue
Block a user