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:
@@ -26,29 +26,28 @@ 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,
|
||||
list.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
content('.img-article-item')
|
||||
.find('img')
|
||||
.each(function () {
|
||||
content(this).attr('src', content(this).prev().attr('data-srcset').split('?')[0]);
|
||||
});
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
content('.img-article-item')
|
||||
.find('img')
|
||||
.each(function () {
|
||||
content(this).attr('src', content(this).prev().attr('data-srcset').split('?')[0]);
|
||||
});
|
||||
content('.ad-zone-container, .sharing, .sentinel-article-nextArticle, .article-tags, .w-article-author-bio, .ml-form-embedContainer').remove();
|
||||
|
||||
content('.ad-zone-container, .sharing, .sentinel-article-nextArticle, .article-tags, .w-article-author-bio, .ml-form-embedContainer').remove();
|
||||
item.description = content('.article-body').html();
|
||||
item.author = content('a.author').text().replace('By ', '');
|
||||
item.pubDate = new Date(content('time').attr('datetime')).toUTCString();
|
||||
|
||||
item.description = content('.article-body').html();
|
||||
item.author = content('a.author').text().replace('By ', '');
|
||||
item.pubDate = new Date(content('time').attr('datetime')).toUTCString();
|
||||
|
||||
return item;
|
||||
})
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user