mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-01 14:57:14 +08:00
fix(route): fix rsshub routes
cheerio(dom) is removed in cheerio v1.0.0-rc.9
This commit is contained in:
@@ -37,14 +37,15 @@ module.exports = async (ctx) => {
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const page = $('.page').get();
|
||||
const item = $('.routeBlock').get();
|
||||
return Promise.resolve({ item, type });
|
||||
return { page, item, type };
|
||||
})
|
||||
);
|
||||
const list = [];
|
||||
all.forEach(({ item, type }) => {
|
||||
all.forEach(({ page, item, type }) => {
|
||||
item.forEach((item) => {
|
||||
list.push({ item, type });
|
||||
list.push({ page, item, type });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -52,9 +53,9 @@ module.exports = async (ctx) => {
|
||||
title: 'RSSHub 有新路由啦',
|
||||
link: 'https://docs.rsshub.app',
|
||||
description: '万物皆可 RSS',
|
||||
item: list.map(({ item, type }) => {
|
||||
item = cheerio(item);
|
||||
item.find('.header-anchor').remove();
|
||||
item: list.map(({ page, item, type }) => {
|
||||
const $ = cheerio.load(page);
|
||||
item = $(item);
|
||||
const titleEle = item.prevAll('h2').eq(0);
|
||||
return {
|
||||
title: `${titleEle.text().slice(2)} - ${item.prevAll('h3').eq(0).text().slice(2)}`,
|
||||
|
||||
Reference in New Issue
Block a user