From 77ac67e2b00c490b465a91df806787fb22cfd0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Wed, 12 Jun 2019 17:37:49 +0800 Subject: [PATCH] fix: zhengce-zuixin (#2382) --- lib/routes/gov/zhengce/zuixin.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/routes/gov/zhengce/zuixin.js b/lib/routes/gov/zhengce/zuixin.js index b2f4daf653..b027aef612 100644 --- a/lib/routes/gov/zhengce/zuixin.js +++ b/lib/routes/gov/zhengce/zuixin.js @@ -14,14 +14,15 @@ module.exports = async (ctx) => { const $el = $list(el); const $a = $el.find('h4 a'); const href = $a.attr('href'); - const key = `gov_zhengce: ${href}`; + const link = href.startsWith('/zhengce') ? `http://www.gov.cn${href}` : href; + const key = `gov_zhengce_zuixin: ${link}`; let description; const value = await ctx.cache.get(key); if (value) { description = value; } else { - const contentData = await got.get(href.startsWith('/zhengce') ? `http://www.gov.cn${href}` : href); + const contentData = await got.get(link); const $content = cheerio.load(contentData.data); description = $content('#UCAP-CONTENT').html(); ctx.cache.set(key, description); @@ -30,7 +31,8 @@ module.exports = async (ctx) => { return { title: $a.text(), description, - link: $a.attr('href'), + guid: href, + link, pubDate: new Date($el.find('.date').text()).toUTCString(), }; })