feat(inoreader): rss (#12196)
* feat(inoreader): rss * Update docs/en/reading.md * Update docs/reading.md ---------
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
module.exports = {
|
||||
'/html_clip/:user/:tag/:num?': ['BeautyyuYanli'],
|
||||
'/rss/:user/:tag': ['NavePnow'],
|
||||
};
|
||||
|
||||
@@ -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,3 +1,4 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/html_clip/:user/:tag', require('./index'));
|
||||
router.get('/rss/:user/:tag', require('./rss'));
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user