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:
iceqing
2022-02-08 19:22:26 +08:00
committed by GitHub
parent dbb1c0b02d
commit 2f7c282d3c
6 changed files with 66 additions and 0 deletions
+12
View File
@@ -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
### 最新文章
+11
View File
@@ -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" />
+24
View File
@@ -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,
})),
};
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'/polkaworld/newest': ['iceqing'],
};
+13
View File
@@ -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',
},
],
},
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/newest', require('./home'));
};