parent
ec7568146b
commit
46bdcb18cc
|
|
@ -12,7 +12,7 @@ module.exports = async (ctx) => {
|
|||
const $ = cheerio.load(data, { decodeEntities: false });
|
||||
|
||||
const list = $('.media_articles ul li')
|
||||
.slice(0, 3)
|
||||
.slice(0, 5)
|
||||
.map((_, item) => {
|
||||
item = $(item);
|
||||
const a = item.find('h2.media_article_title a');
|
||||
|
|
@ -44,8 +44,16 @@ module.exports = async (ctx) => {
|
|||
);
|
||||
content = cheerio.load(itemData, { decodeEntities: false });
|
||||
} else {
|
||||
const response = await got.get(item.link);
|
||||
content = cheerio.load(response.data, { decodeEntities: false });
|
||||
const itemData = await ctx.cache.tryGet(
|
||||
item.link,
|
||||
async () =>
|
||||
(
|
||||
await got.get(item.link, {
|
||||
responseType: 'buffer',
|
||||
})
|
||||
).data
|
||||
);
|
||||
content = cheerio.load(itemData, { decodeEntities: false });
|
||||
}
|
||||
|
||||
const eDescription = content('.post_body').html();
|
||||
|
|
|
|||
Loading…
Reference in New Issue