From 552de81efc26d3a4d36afff0bbbd47dace011304 Mon Sep 17 00:00:00 2001 From: zytomorrow Date: Sun, 23 Jan 2022 03:00:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BE=B7=E9=98=B3=E8=80=83=E8=AF=95?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=20ssl=E8=AF=81=E4=B9=A6=E8=BF=87=E6=9C=9F=20?= =?UTF-8?q?(#8676)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/routes/dykszx/news.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/routes/dykszx/news.js b/lib/routes/dykszx/news.js index 604a24050..1d7feedd1 100644 --- a/lib/routes/dykszx/news.js +++ b/lib/routes/dykszx/news.js @@ -4,10 +4,13 @@ const { parseDate } = require('@/utils/parse-date'); const timezone = require('@/utils/timezone'); const host = 'https://www.dykszx.com'; +// disable ssl check +const options = { https: { rejectUnauthorized: false } }; + const getContent = (href, caches) => { const newsPage = `${host}${href}`; return caches.tryGet(newsPage, async () => { - const response = await got.get(newsPage); + const response = await got.get(newsPage, options); const data = response.data; const $ = cheerio.load(data); const newsTime = $('body > div:nth-child(3) > div.page.w > div.shuxing.w') @@ -31,7 +34,7 @@ const newsTypeObj = { module.exports = async (ctx) => { const newsType = ctx.params.type || 'all'; - const response = await got.get(host); + const response = await got(host, options); const data = response.data; const $ = cheerio.load(data); const newsList = $(newsTypeObj[newsType].selector).toArray();