fix: 德阳考试中心 ssl证书过期 (#8676)
This commit is contained in:
parent
0e93e8e268
commit
552de81efc
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue