From 662874849ba22748cba48d44cb8cb015d8563ab2 Mon Sep 17 00:00:00 2001 From: WUGqnwvMQPzl <36147447+WUGqnwvMQPzl@users.noreply.github.com> Date: Sat, 21 May 2022 22:34:25 +0800 Subject: [PATCH] fix(route): fetch rich HTML content on chinanews (#9798) * fix(route): fetch rich HTML content on chinanews * fix: remove ads --- lib/v2/chinanews/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/v2/chinanews/index.js b/lib/v2/chinanews/index.js index c8e56821a..ede095718 100644 --- a/lib/v2/chinanews/index.js +++ b/lib/v2/chinanews/index.js @@ -28,19 +28,20 @@ module.exports = async (ctx) => { url: item.link, }); const content = cheerio.load(detailResponse.data); + content('.adInContent').remove(); if (content('div.content_desc').length > 0) { - item.description = content('div.content_desc').text(); + item.description = content('div.content_desc').html(); item.author = content('a.source').text(); const info = content('p', '.left').text().trim().slice(5).split(' '); item.author = info[2].trim(); item.pubDate = timezone(parseDate(info[0] + info[1], 'YYYY年MM月DD日HH:mm'), +8); } else if (content('div.t3').length > 0) { - item.description = content('div.t3').text(); + item.description = content('div.t3').html(); const info = content('div[style="text-align:right;font-size:12px;"]').text().slice(5).split(' '); item.author = info[2]; item.pubDate = timezone(parseDate(info[0] + info[1], 'YYYY-MM-DDHH:mm'), +8); } else { - item.description = content('div.left_zw').text(); + item.description = content('div.left_zw').html(); const info = content('div.left-t') .contents() .filter(function () {