From 8d7d2386cdc872e258013b4f954acb83f5e96e20 Mon Sep 17 00:00:00 2001 From: EsuRt <15177069+EsuRt@users.noreply.github.com> Date: Thu, 8 Aug 2019 09:10:45 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=A3=E5=86=B3=E4=B8=AD=E5=9B=BD?= =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=BD=91=E9=83=A8=E5=88=86=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E7=9A=84=E5=85=A8=E6=96=87=E6=A0=B7=E5=BC=8F=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E6=9B=B4=E6=94=B9=E5=90=B9=E9=A3=8E?= =?UTF-8?q?=E4=BC=9A=E5=9C=B0=E5=9D=80=20(#2780)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/gov/news/index.js | 10 ++++------ lib/routes/gov/statecouncil/briefing.js | 8 ++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/routes/gov/news/index.js b/lib/routes/gov/news/index.js index 4ed928936..5e85eb3c5 100644 --- a/lib/routes/gov/news/index.js +++ b/lib/routes/gov/news/index.js @@ -44,13 +44,11 @@ module.exports = async (ctx) => { const description = await ctx.cache.tryGet(contenlUrl, async () => { const fullTextGet = await got.get(contenlUrl); const fullTextData = cheerio.load(fullTextGet.data); - if (uid === 'yaowen') { + const $1 = fullTextData.html(); + if ($1.search(/UCAP-CONTENT/g) === -1) { fullText = fullTextData('body').html(); } else { - fullText = fullTextData('.pages_content').html(); - if (fullText === null) { - fullText = fullTextData('body').html(); // 解决国务院信息部分条目无法获取全文 - } + fullText = fullTextData('#UCAP-CONTENT').html(); } const regImg = /(img src=")(.*)(".*)/g; const regUrl = /(http.*\/)(content.*)/; @@ -60,7 +58,7 @@ module.exports = async (ctx) => { return { title: item.find('a').text(), description: description, - link: item.find('a').attr('href'), + link: contenlUrl, }; }) .get() diff --git a/lib/routes/gov/statecouncil/briefing.js b/lib/routes/gov/statecouncil/briefing.js index ab5d2f9aa..b52f3ddef 100644 --- a/lib/routes/gov/statecouncil/briefing.js +++ b/lib/routes/gov/statecouncil/briefing.js @@ -2,10 +2,10 @@ const got = require('@/utils/got'); const cheerio = require('cheerio'); module.exports = async (ctx) => { - const link = `http://www.scio.gov.cn/32344/index.htm`; + const link = `http://www.gov.cn/xinwen/xwfb_wszb.htm`; const listData = await got.get(link); const $ = cheerio.load(listData.data); - const list = $('.list .mb10 .mt10 li'); + const list = $('.list01 li'); ctx.state.data = { title: '国务院 - 吹风会', @@ -20,12 +20,12 @@ module.exports = async (ctx) => { const description = await ctx.cache.tryGet(contenlUrl, async () => { const fullText = await got.get(contenlUrl); const fullTextData = cheerio.load(fullText.data); - return fullTextData('.textlive'); + return fullTextData('.online_list').html(); }); return { title: item.find('a').text(), description: description, - link: item.find('a').attr('href'), + link: contenlUrl, }; }) .get()