mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-18 04:38:50 +08:00
refactor: avoid promise overhead (#8028)
This commit is contained in:
@@ -24,24 +24,23 @@ module.exports = async (ctx) => {
|
||||
.get();
|
||||
|
||||
const items = await Promise.all(
|
||||
list.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
item.title = content('title').text();
|
||||
item.title = content('title').text();
|
||||
|
||||
content('.aside').remove();
|
||||
content('.aside').remove();
|
||||
|
||||
item.description = content('.content').html();
|
||||
item.pubDate = new Date(content('time').attr('datetime')).toUTCString();
|
||||
item.description = content('.content').html();
|
||||
item.pubDate = new Date(content('time').attr('datetime')).toUTCString();
|
||||
|
||||
return item;
|
||||
})
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user