From 56f6038f6fdafdb302df3650d04ce310ce028a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E9=A3=9E=E9=B1=BC?= Date: Thu, 22 Jun 2023 19:39:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(route):=20=E4=B8=9C=E6=96=B9=E8=B4=A2?= =?UTF-8?q?=E5=AF=8C=E7=A0=94=E6=8A=A5=E8=A2=AB=E5=88=A0=E9=99=A4=E6=97=B6?= =?UTF-8?q?=E7=9A=84try=20catch=20=20(#12693)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(route): add 东方财富研究报告 * feat(route): add 东方财富研究报告 * update: 东方财富研究报告文档 * feat(router): add 东方财富研究报告 * feat(router): add 东方财富研究报告 * fix:link add .jshtml suffix * feat(route):add 东方财富网行业研究 * chore: data link * fix(route): 东方财富研报被删除时的try catch * fix(route): 东方财富研报被删除时的try catch --- lib/v2/eastmoney/report/index.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/v2/eastmoney/report/index.js b/lib/v2/eastmoney/report/index.js index 76b244f0c..cf08e4e5b 100644 --- a/lib/v2/eastmoney/report/index.js +++ b/lib/v2/eastmoney/report/index.js @@ -38,11 +38,15 @@ module.exports = async (ctx) => { const items = await Promise.all( list.map((item) => ctx.cache.tryGet(item.link, async () => { - const { data: response } = await got(item.link); - const $ = cheerio.load(response); - item.link = $('.pdf-link').attr('href'); - item.description = $('.ctx-content').text(); - return item; + try { + const { data: response } = await got(item.link); + const $ = cheerio.load(response); + item.link = $('.pdf-link').attr('href'); + item.description = $('.ctx-content').text(); + return item; + } catch (error) { + return item; + } }) ) );