fix: /nikkei/news (#6343)

This commit is contained in:
Arracc 2020-12-07 02:07:51 +08:00 committed by GitHub
parent 8db7c0042a
commit b0e7d38376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -113,7 +113,16 @@ module.exports = async (ctx) => {
const description = await ctx.cache.tryGet(link, async () => {
const response = await got.get(link);
const $ = cheerio.load(response.data);
return $('div.cmn-article_text.a-cf.JSID_key_fonttxt.m-streamer_medium').html();
if ($('section.container_cz8tiun').length > 0) {
$('section.container_cz8tiun').find('figure').each((index, item) => {
const imgSrc = $(item).attr('data-src-for-image-viewer');
const $imgElement = $('<img src="' + imgSrc + '"/>');
$(item).prepend($imgElement);
});
return $('section.container_cz8tiun').html();
} else {
return $('div.sc-54bcr2-2.jMNzyO').html();
}
});
return {