fix economist article displaying (#10884)

This commit is contained in:
Felix Hsu
2022-09-24 17:30:39 +08:00
committed by GitHub
parent 7fdffa9133
commit 3119ebda4d

View File

@@ -7,7 +7,7 @@ const getArticleDetail = async (link, ctx) =>
const response = await got(link);
const $ = cheerio.load(response.data);
$('div.article-audio-player__center-tooltip').remove();
const nextData = JSON.parse($('head script[type="application/ld+json"]').text());
const nextData = JSON.parse($('head script[type="application/ld+json"]').first().text());
const article = ($('figure[class^=css-]').first().parent().parent().html() || '') + $('p.article__body-text').parent().html();
const categories = nextData.keywords?.map((k) => k);