feat(inoreader): rss (#12196)

* feat(inoreader): rss

* Update docs/en/reading.md

* Update docs/reading.md
---------
This commit is contained in:
Evan
2023-03-30 02:30:27 +08:00
committed by GitHub
parent 2b7be504d9
commit eed561dee7
6 changed files with 43 additions and 0 deletions
+6
View File
@@ -35,6 +35,12 @@ Eg: <https://www.inoreader.com/stream/user/1006346356/tag/News/view/html?n=3>
</RouteEn>
### RSS
<RouteEn author="NavePnow" example="/inoreader/rss/1005137674/user-favorites" path="/inoreader/rss/:user/:tag" :paramsDesc="[
'user id, the interger after user/ in the example URL',
'tag, the string after tag/ in the example URL',
]">
## kakuyomu
+7
View File
@@ -35,6 +35,13 @@ pageClass: routes
</Route>
### RSS
<Route author="NavePnow" example="/inoreader/rss/1005137674/user-favorites" path="/inoreader/rss/:user/:tag" :paramsDesc="[
'用户 id, 即举例网址 URL 中的 user/ 后的数字',
'标签名, 即举例网址 URL 中的 tag/ 后的内容'
]">
## kakuyomu
### 章节更新
+1
View File
@@ -1,3 +1,4 @@
module.exports = {
'/html_clip/:user/:tag/:num?': ['BeautyyuYanli'],
'/rss/:user/:tag': ['NavePnow'],
};
+6
View File
@@ -12,6 +12,12 @@ module.exports = {
return `/inoreader/html_clip/${params.user}/${params.tag}` + (limit ? `?limit=${limit}` : '');
},
},
{
title: 'RSS',
docs: 'https://docs.rsshub.app/reading.html#inoreader',
source: ['/stream/user/:user/tag/:tag'],
target: (params) => `/inoreader/rss/${params.user}/${params.tag}`,
},
],
},
};
+1
View File
@@ -1,3 +1,4 @@
module.exports = function (router) {
router.get('/html_clip/:user/:tag', require('./index'));
router.get('/rss/:user/:tag', require('./rss'));
};
+22
View File
@@ -0,0 +1,22 @@
const parser = require('@/utils/rss-parser');
module.exports = async (ctx) => {
const user = ctx.params.user;
const tag = ctx.params.tag;
const rootUrl = 'https://www.inoreader.com/stream';
const rssUrl = `${rootUrl}/user/${user}/tag/${tag}`;
const feed = await parser.parseURL(rssUrl);
feed.items = feed.items.map((item) => ({
title: item.title,
pubDate: item.pubDate,
link: item.link,
description: item.content,
category: item.categories,
}));
ctx.state.data = {
title: feed.title,
link: feed.link,
description: feed.description,
item: feed.items,
};
};