From 8ee4054e92296bdf828a76545b3c48ff1b5b6746 Mon Sep 17 00:00:00 2001 From: Yuk <40992553+Yuk-0v0@users.noreply.github.com> Date: Sun, 23 Jan 2022 04:21:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=B7=AF=E7=94=B1xiji?= =?UTF-8?q?ayi=E5=9B=BE=E7=89=87=E6=98=BE=E7=A4=BA=20(#8808)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: yuk7-0v0 <91721784+yuk7-0v0@users.noreply.github.com> --- lib/v2/ithome/zt.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/v2/ithome/zt.js b/lib/v2/ithome/zt.js index 0d1d5a5f9a..8d47f5891d 100644 --- a/lib/v2/ithome/zt.js +++ b/lib/v2/ithome/zt.js @@ -36,8 +36,16 @@ module.exports = async (ctx) => { }); const content = cheerio.load(detailResponse.data); + const post = content('.post_content'); - item.description = content('.post_content').html(); + post.find('img[data-original]').each((_, ele) => { + ele = $(ele); + ele.attr('src', ele.attr('data-original')); + ele.removeAttr('class'); + ele.removeAttr('data-original'); + }); + + item.description = post.html(); item.author = content('#author_baidu').text().replace('作者:', ''); item.pubDate = timezone(parseDate(content('#pubtime_baidu').text()), +8);