From 0851784835f2fb9aaade5322446dcb7e62e70f8e Mon Sep 17 00:00:00 2001 From: hoilc Date: Tue, 23 Jun 2020 19:18:18 +0800 Subject: [PATCH] fix: update taptap topic selector (#5031) --- lib/routes/taptap/topic.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/routes/taptap/topic.js b/lib/routes/taptap/topic.js index f16e632e3..09fe00be5 100644 --- a/lib/routes/taptap/topic.js +++ b/lib/routes/taptap/topic.js @@ -18,15 +18,15 @@ module.exports = async (ctx) => { const $ = cheerio.load(topics_list_data); const app_img = $('.group-info > a > img').attr('src'); - const app_name = $('.breadcrumb > li.active').text(); + const app_name = $('.group-detail > h2 > a').first().text(); const label_name = $('.tab-label a.active span').text(); - const topics_list = $('.item-content').toArray(); + const topics_list = $('.item-content').get(); const parseContent = (htmlString) => { const $ = cheerio.load(htmlString); const author = $('.user-name-identity'); - const content = $('.topic-content > .bbcode-body'); + const content = $('.bbcode-body').first(); const time = $('.topic-update-time').length === 0 ? $('.topic-info [data-dynamic-time]') : $('.topic-update-time [data-dynamic-time]'); const pub_date = time.length === 0 ? new Date() : new Date(time.text().trim()); @@ -45,7 +45,7 @@ module.exports = async (ctx) => { const out = await Promise.all( topics_list.map(async (item) => { const $ = cheerio.load(item); - const title = $('.item-title > a'); + const title = $('.content-text > a').first(); const link = title.attr('href'); const cache = await ctx.cache.get(link); @@ -77,7 +77,7 @@ module.exports = async (ctx) => { ); ctx.state.data = { - title: `TapTap论坛 ${app_name} - ${label_name}`, + title: `${app_name} - ${label_name} - TapTap论坛`, link: url, image: app_img, item: out.filter((item) => item !== ''),