From cd63190a966e4d0672b801db7f7a7052db7fa728 Mon Sep 17 00:00:00 2001 From: Enoch Ma Date: Sun, 12 May 2019 15:08:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A5=BD=E5=A5=87=E5=BF=83=E6=97=A5?= =?UTF-8?q?=E6=8A=A5=E4=B8=93=E6=A0=8F=2051=20(#2101)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/qdaily/column.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/routes/qdaily/column.js b/lib/routes/qdaily/column.js index 34c4e680f4..a5752097ad 100644 --- a/lib/routes/qdaily/column.js +++ b/lib/routes/qdaily/column.js @@ -14,11 +14,18 @@ module.exports = async (ctx) => { const out = await Promise.all( list.map(async (item, i) => { const $ = cheerio.load(item); - const time = $('.smart-date').attr('data-origindate'); + let time = $('.smart-date').attr('data-origindate'); let title = $('.title').text(); if (!title) { title = $('.smart-dotdotdot').text(); } + if (!title) { + const mmTitle = $('.makemoney-title').text(); + const description = $('.makemoney-discription').text(); + title = mmTitle + ':' + description; + time = new Date(); + } + const itemUrl = $('a').attr('href'); const allUrl = `http://www.qdaily.com${itemUrl}`; const cache = await ctx.cache.get(allUrl); @@ -49,7 +56,12 @@ module.exports = async (ctx) => { $('.article-detail-bd .author-share').remove(); $('.article-detail-ft').remove(); - out[indexList[i]].description = $('.main .com-article-detail').html(); + if (out[indexList[i]].link.match('/weeklies/')) { + out[indexList[i]].description = $('.packery-container').html(); + } else { + out[indexList[i]].description = $('.main .com-article-detail').html(); + } + ctx.cache.set(out[indexList[i]].link, JSON.stringify(out[i])); } ctx.state.data = {