fix:The Economist 全文获取修复 (#5095)

This commit is contained in:
MisteryMonster
2020-07-02 12:17:07 +08:00
committed by GitHub
parent 9254b815e1
commit b622409a62
+6 -8
View File
@@ -18,13 +18,11 @@ module.exports = async (ctx) => {
});
const $ = cheerio.load(response.data);
$('.newsletter-form--inline').remove();
$('.blog-post__asideable-wrapper').remove();
content = '<div>[' + $('h1 .flytitle-and-title__flytitle').text() + ']</div>';
content += '<div><i>' + $('.blog-post__description').text() + '</i></div>';
content += '<br />';
content += $('.blog-post__inner').html();
$('aside').remove();
$('div.ds-chapter-list').remove();
content = $('div.article__lead-image').html();
content += $('header.article__header').html();
content += $('div.layout-article-body').attr('itemprop', 'text').html();
ctx.cache.set(link, content);
@@ -32,7 +30,7 @@ module.exports = async (ctx) => {
};
const items = await Promise.all(
feed.items.map(async (item) => ({
feed.items.slice(0, 10).map(async (item) => ({
title: item.title,
description: await getFullText(item.link),
link: item.link,