fix: slice issue (#3855)
This commit is contained in:
parent
b833b99467
commit
70d40284c9
|
|
@ -44,7 +44,7 @@ module.exports = async (ctx) => {
|
|||
link: url,
|
||||
item: await Promise.all(
|
||||
list
|
||||
.slice(1, 12)
|
||||
.slice(0, 12)
|
||||
.map(async (index, item) => {
|
||||
item = $(item);
|
||||
let fullText = '';
|
||||
|
|
|
|||
|
|
@ -11,24 +11,23 @@ module.exports = async (ctx) => {
|
|||
title: '国务院 - 吹风会',
|
||||
link: link,
|
||||
item: await Promise.all(
|
||||
list &&
|
||||
list
|
||||
.slice(1, 12)
|
||||
.map(async (index, item) => {
|
||||
item = $(item);
|
||||
const contenlUrl = item.find('a').attr('href');
|
||||
const description = await ctx.cache.tryGet(contenlUrl, async () => {
|
||||
const fullText = await got.get(contenlUrl);
|
||||
const fullTextData = cheerio.load(fullText.data);
|
||||
return fullTextData('.online_list').html();
|
||||
});
|
||||
return {
|
||||
title: item.find('a').text(),
|
||||
description: description,
|
||||
link: contenlUrl,
|
||||
};
|
||||
})
|
||||
.get()
|
||||
list
|
||||
.slice(0, 12)
|
||||
.map(async (index, item) => {
|
||||
item = $(item);
|
||||
const contenlUrl = item.find('a').attr('href');
|
||||
const description = await ctx.cache.tryGet(contenlUrl, async () => {
|
||||
const fullText = await got.get(contenlUrl);
|
||||
const fullTextData = cheerio.load(fullText.data);
|
||||
return fullTextData('.online_list').html();
|
||||
});
|
||||
return {
|
||||
title: item.find('a').text(),
|
||||
description: description,
|
||||
link: contenlUrl,
|
||||
};
|
||||
})
|
||||
.get()
|
||||
),
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ module.exports = async (ctx) => {
|
|||
link: link,
|
||||
item: await Promise.all(
|
||||
list
|
||||
.slice(1, 12)
|
||||
.slice(0, 12)
|
||||
.map(async (index, item) => {
|
||||
item = $(item);
|
||||
// 获取全文
|
||||
|
|
|
|||
Loading…
Reference in New Issue