fix: 德阳考试中心 ssl证书过期 (#8676)

This commit is contained in:
zytomorrow 2022-01-23 03:00:52 +08:00 committed by GitHub
parent 0e93e8e268
commit 552de81efc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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();