mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-19 09:52:21 +08:00
fix(route): (Maybe) fix the stheadline feed occasionally dropping details. (#13206)
This commit is contained in:
@@ -11,7 +11,7 @@ module.exports = async (ctx) => {
|
||||
const { data: response } = await got(url);
|
||||
const $ = cheerio.load(response);
|
||||
|
||||
const items = $(`${category === '即時' ? '.moreNews > .col-md-4' : ''} .media-body > .my-2 > a`)
|
||||
let items = $(`${category === '即時' ? '.moreNews > .col-md-4' : ''} .media-body > .my-2 > a`)
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
@@ -22,17 +22,18 @@ module.exports = async (ctx) => {
|
||||
};
|
||||
});
|
||||
|
||||
await Promise.all(
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const { data: response } = await got(item.link);
|
||||
const $ = cheerio.load(response);
|
||||
|
||||
item.description = $('.paragraphs').html();
|
||||
item.pubDate = timezone(parseDate($('.content .date').text()), +8);
|
||||
item.category = [$('nav .nav-item.active a')?.text()?.trim(), ...$("meta[name='keyword']").attr('content').split(',')];
|
||||
|
||||
return item;
|
||||
return {
|
||||
...item,
|
||||
description: $('.paragraphs').html(),
|
||||
pubDate: timezone(parseDate($('.content .date').text()), +8),
|
||||
category: [$('nav .nav-item.active a')?.text()?.trim(), ...$("meta[name='keyword']").attr('content').split(',')],
|
||||
};
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user