21 lines
511 B
JavaScript
21 lines
511 B
JavaScript
const got = require('@/utils/got');
|
|
const cheerio = require('cheerio');
|
|
|
|
const processItems = (list, ctx) =>
|
|
Promise.all(
|
|
list.map((item) =>
|
|
ctx.cache.tryGet(item.link, async () => {
|
|
const detailResponse = await got.post(item.link);
|
|
const content = cheerio.load(detailResponse.data);
|
|
|
|
item.description = content('div.xxy_text').html();
|
|
|
|
return item;
|
|
})
|
|
)
|
|
);
|
|
|
|
module.exports = {
|
|
processItems,
|
|
};
|