diff --git a/docs/en/reading.md b/docs/en/reading.md index c79de7b7b..8cd10f2fd 100644 --- a/docs/en/reading.md +++ b/docs/en/reading.md @@ -35,6 +35,12 @@ Eg: +### RSS + + ## kakuyomu diff --git a/docs/reading.md b/docs/reading.md index 0be0e19ae..8a3ca6b80 100644 --- a/docs/reading.md +++ b/docs/reading.md @@ -35,6 +35,13 @@ pageClass: routes +### RSS + + + ## kakuyomu ### 章节更新 diff --git a/lib/v2/inoreader/maintainer.js b/lib/v2/inoreader/maintainer.js index 3860a6299..b8c34cc42 100644 --- a/lib/v2/inoreader/maintainer.js +++ b/lib/v2/inoreader/maintainer.js @@ -1,3 +1,4 @@ module.exports = { '/html_clip/:user/:tag/:num?': ['BeautyyuYanli'], + '/rss/:user/:tag': ['NavePnow'], }; diff --git a/lib/v2/inoreader/radar.js b/lib/v2/inoreader/radar.js index 319625db5..357e8cb6a 100644 --- a/lib/v2/inoreader/radar.js +++ b/lib/v2/inoreader/radar.js @@ -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}`, + }, ], }, }; diff --git a/lib/v2/inoreader/router.js b/lib/v2/inoreader/router.js index d8961e1bb..af578b203 100644 --- a/lib/v2/inoreader/router.js +++ b/lib/v2/inoreader/router.js @@ -1,3 +1,4 @@ module.exports = function (router) { router.get('/html_clip/:user/:tag', require('./index')); + router.get('/rss/:user/:tag', require('./rss')); }; diff --git a/lib/v2/inoreader/rss.js b/lib/v2/inoreader/rss.js new file mode 100644 index 000000000..0357cae16 --- /dev/null +++ b/lib/v2/inoreader/rss.js @@ -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, + }; +};