mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-14 01:00:38 +08:00
fix(route): nbd (#11847)
This commit is contained in:
@@ -7,7 +7,7 @@ module.exports = async (ctx) => {
|
|||||||
const id = ctx.params.id ?? '3';
|
const id = ctx.params.id ?? '3';
|
||||||
|
|
||||||
const rootUrl = 'https://www.nbd.com.cn';
|
const rootUrl = 'https://www.nbd.com.cn';
|
||||||
const currentUrl = `${rootUrl}/columns/${id}`;
|
const currentUrl = `${rootUrl}/columns/${id}/`;
|
||||||
|
|
||||||
const response = await got({
|
const response = await got({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
@@ -17,15 +17,15 @@ module.exports = async (ctx) => {
|
|||||||
const $ = cheerio.load(response.data);
|
const $ = cheerio.load(response.data);
|
||||||
|
|
||||||
const list = $('.u-news-title a')
|
const list = $('.u-news-title a')
|
||||||
.map((_, item) => {
|
.toArray()
|
||||||
|
.map((item) => {
|
||||||
item = $(item);
|
item = $(item);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: item.text(),
|
title: item.text(),
|
||||||
link: 'https:' + item.attr('href'),
|
link: item.attr('href'),
|
||||||
};
|
};
|
||||||
})
|
});
|
||||||
.get();
|
|
||||||
|
|
||||||
const items = await Promise.all(
|
const items = await Promise.all(
|
||||||
list.map((item) =>
|
list.map((item) =>
|
||||||
@@ -45,7 +45,7 @@ module.exports = async (ctx) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
ctx.state.data = {
|
ctx.state.data = {
|
||||||
title: `${$('.u-channelname').text()} - 每经网`,
|
title: `${$('h1').text()} - 每经网`,
|
||||||
link: currentUrl,
|
link: currentUrl,
|
||||||
item: items,
|
item: items,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user