From b1410b72bed407b9a0fa62eda2c66882a5a893f5 Mon Sep 17 00:00:00 2001 From: BoYanZh Date: Fri, 2 Dec 2022 06:05:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(route):=20=E6=9C=A8=E6=9C=A8=E5=8D=9A?= =?UTF-8?q?=E5=AE=A2=20(#11361)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/v2/liulinblog/utils.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/v2/liulinblog/utils.js b/lib/v2/liulinblog/utils.js index 2071c64b8..395a78494 100644 --- a/lib/v2/liulinblog/utils.js +++ b/lib/v2/liulinblog/utils.js @@ -4,12 +4,12 @@ const { parseDate } = require('@/utils/parse-date'); const processList = (res) => { const $ = cheerio.load(res.data); - const list = $('div.posts-wrapper > div.col-lg-12') + const list = $('div.archive.container > div.row > div > div > div.row.posts-wrapper.scroll > div') .map((_, item) => ({ title: $(item).find('h2.entry-title').text(), link: $(item).find('h2.entry-title > a').attr('href'), pubDate: parseDate($(item).find('time').attr('datetime')), - author: $(item).find('span.meta-author > a').attr('title'), + author: '60秒读懂世界', })) .get(); @@ -22,8 +22,11 @@ const processItems = async (list, ctx) => { ctx.cache.tryGet(item.link, async () => { const detailResponse = await got(item.link); const $ = cheerio.load(detailResponse.data); - - item.description = $('div.entry-wrapper').html(); + const fullContent = $('div > div.entry-wrapper > div.entry-content'); + fullContent.find('img').remove(); + fullContent.find('div.pt-0').remove(); + fullContent.find('div.post-note').remove(); + item.description = fullContent.html(); return item; })