diff --git a/lib/routes/rsshub/rss.js b/lib/routes/rsshub/rss.js index 979a868d2..68fa7b24f 100644 --- a/lib/routes/rsshub/rss.js +++ b/lib/routes/rsshub/rss.js @@ -14,12 +14,14 @@ module.exports = async (ctx) => { const $ = cheerio.load(data); const item = $('.routeBlock').get(); - return Promise.resolve(item); + return Promise.resolve({ item, type }); }) ); - let list = []; - all.forEach((item) => { - list = list.concat(item); + const list = []; + all.forEach(({ item, type }) => { + item.forEach((item) => { + list.unshift({ item, type }); + }); }); ctx.state.data = { @@ -28,7 +30,7 @@ module.exports = async (ctx) => { description: '万物皆可 RSS', item: list && - list.reverse().map((item) => { + list.map(({ item, type }) => { item = cheerio(item); item.find('.header-anchor').remove(); const titleEle = item.prevAll('h2').eq(0); @@ -39,7 +41,7 @@ module.exports = async (ctx) => { .eq(0) .text()}`, description: item.html(), - link: `https://docs.rsshub.app#${encodeURIComponent( + link: `https://docs.rsshub.app/${type}.html#${encodeURIComponent( titleEle.find('.header-anchor').attr('href') && titleEle .find('.header-anchor')