diff --git a/lib/routes-deprecated/universities/hnust/art/index.js b/lib/routes-deprecated/universities/hnust/art/index.js index ff0790b5f0..b386832542 100644 --- a/lib/routes-deprecated/universities/hnust/art/index.js +++ b/lib/routes-deprecated/universities/hnust/art/index.js @@ -4,12 +4,7 @@ const cheerio = require('cheerio'); module.exports = async (ctx) => { const base = 'https://art.hnust.edu.cn/ggtz/'; const link = base + 'index.htm'; - const response = await got.get({ - url: link, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(link); const $ = cheerio.load(response.data); const list = $('.newsList03 li'); diff --git a/lib/routes-deprecated/universities/hnust/jwc/index.js b/lib/routes-deprecated/universities/hnust/jwc/index.js index 25a7269b2b..f42fb1a62f 100644 --- a/lib/routes-deprecated/universities/hnust/jwc/index.js +++ b/lib/routes-deprecated/universities/hnust/jwc/index.js @@ -4,12 +4,7 @@ const cheerio = require('cheerio'); module.exports = async (ctx) => { const base = 'https://jwc.hnust.edu.cn/gzzd2_20170827120536008171/jwk3_20170827120536008171/'; const link = base + 'index.htm'; - const response = await got.get({ - url: link, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(link); const $ = cheerio.load(response.data); const list = $('.articleList ul li'); ctx.state.data = { diff --git a/lib/routes-deprecated/universities/slu/utils.js b/lib/routes-deprecated/universities/slu/utils.js index 586b92efcd..94f347a863 100644 --- a/lib/routes-deprecated/universities/slu/utils.js +++ b/lib/routes-deprecated/universities/slu/utils.js @@ -4,13 +4,7 @@ const cheerio = require('cheerio'); module.exports = { fetchMain: async (url, dataElement) => { - const response = await got({ - method: 'get', - url, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(url); const $ = cheerio.load(response.data); // 获取列表 return { @@ -40,13 +34,7 @@ module.exports = { } // 获取详情页面的介绍 - const detail_response = await got({ - method: 'get', - url: href, - https: { - rejectUnauthorized: false, - }, - }); + const detail_response = await got(href); const $ = cheerio.load(detail_response.data); const title = $('title').text(); let detail_content = $(contentElement).html(); diff --git a/lib/routes-deprecated/wenxuecity/bbs.js b/lib/routes-deprecated/wenxuecity/bbs.js index 6e5337cb75..04cbc00045 100644 --- a/lib/routes-deprecated/wenxuecity/bbs.js +++ b/lib/routes-deprecated/wenxuecity/bbs.js @@ -5,13 +5,7 @@ const url = require('url'); module.exports = async (ctx) => { const elite = ctx.params.elite === undefined ? 0 : ctx.params.elite; const base_url = `https://bbs.wenxuecity.com/${ctx.params.cat}/?elite=${elite}`; - const response = await got({ - method: 'get', - url: base_url, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(base_url); const data = response.data; const $ = cheerio.load(data); const list = $('div.odd,div.even'); @@ -20,12 +14,7 @@ module.exports = async (ctx) => { .map(async (i, item) => { const link = url.resolve(base_url, $(item).find('a.post').attr('href')); const description = await ctx.cache.tryGet(link, async () => { - const result = await got({ - method: 'get', - url: link, - https: { - rejectUnauthorized: false, - }, + const result = await got(link, { headers: { Referer: base_url, }, diff --git a/lib/routes-deprecated/wenxuecity/blog.js b/lib/routes-deprecated/wenxuecity/blog.js index fb237fbf9c..28361afdac 100644 --- a/lib/routes-deprecated/wenxuecity/blog.js +++ b/lib/routes-deprecated/wenxuecity/blog.js @@ -5,13 +5,7 @@ const url = require('url'); module.exports = async (ctx) => { const blog_id = ctx.params.id; const base_url = `https://blog.wenxuecity.com/myblog/${blog_id}/all.html`; - const response = await got({ - method: 'get', - url: base_url, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(base_url); const data = response.data; const $ = cheerio.load(data); const list = $('div.articleCell.BLK_j_linedot1'); @@ -20,12 +14,7 @@ module.exports = async (ctx) => { .map(async (i, item) => { const link = url.resolve('https://blog.wenxuecity.com', $(item).find('a').attr('href')); const description = await ctx.cache.tryGet(link, async () => { - const result = await got({ - method: 'get', - url: link, - https: { - rejectUnauthorized: false, - }, + const result = await got(link, { headers: { Referer: base_url, }, diff --git a/lib/routes-deprecated/wenxuecity/hot.js b/lib/routes-deprecated/wenxuecity/hot.js index db84f728f4..f22e2b2439 100644 --- a/lib/routes-deprecated/wenxuecity/hot.js +++ b/lib/routes-deprecated/wenxuecity/hot.js @@ -5,13 +5,7 @@ const url = require('url'); module.exports = async (ctx) => { const cid = ctx.params.cid; const base_url = `https://bbs.wenxuecity.com/?cid=${cid}/`; - const response = await got({ - method: 'get', - url: base_url, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(base_url,); const data = response.data; const $ = cheerio.load(data); const list = $('div.item'); @@ -20,12 +14,7 @@ module.exports = async (ctx) => { .map(async (i, item) => { const link = url.resolve('https://bbs.wenxuecity.com/', $(item).find('div.title > a').attr('href')); const description = await ctx.cache.tryGet(link, async () => { - const result = await got({ - method: 'get', - url: link, - https: { - rejectUnauthorized: false, - }, + const result = await got(link, { headers: { Referer: base_url, }, diff --git a/lib/routes-deprecated/wenxuecity/news.js b/lib/routes-deprecated/wenxuecity/news.js index 3069a24ee0..92ef32827e 100644 --- a/lib/routes-deprecated/wenxuecity/news.js +++ b/lib/routes-deprecated/wenxuecity/news.js @@ -4,13 +4,7 @@ const cheerio = require('cheerio'); module.exports = async (ctx) => { const rootUrl = 'https://www.wenxuecity.com'; const currentUrl = `${rootUrl}/news/`; - const response = await got({ - method: 'get', - url: currentUrl, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(currentUrl); const $ = cheerio.load(response.data); const list = $('div.mainwrap div.block div.wrapper ul li a') @@ -27,12 +21,7 @@ module.exports = async (ctx) => { const items = await Promise.all( list.map((item) => ctx.cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: item.link, - https: { - rejectUnauthorized: false, - }, + const detailResponse = await got(item.link, { headers: { Referer: currentUrl, }, diff --git a/lib/routes/bioone/featured.ts b/lib/routes/bioone/featured.ts index c8c9f8ea89..a4bc770e64 100644 --- a/lib/routes/bioone/featured.ts +++ b/lib/routes/bioone/featured.ts @@ -31,11 +31,7 @@ export const route: Route = { async function handler(ctx) { const rootUrl = 'https://bioone.org'; - const response = await got(rootUrl, { - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(rootUrl); const $ = load(response.data); @@ -55,11 +51,7 @@ async function handler(ctx) { items = await Promise.all( items.map((item) => cache.tryGet(item.link, async () => { - const detailResponse = await got(item.link, { - https: { - rejectUnauthorized: false, - }, - }); + const detailResponse = await got(item.link); const content = load(detailResponse.data); item.description = content('#divARTICLECONTENTTop').html(); diff --git a/lib/routes/bioone/journal.ts b/lib/routes/bioone/journal.ts index b7a0a7b551..87ab9f11e0 100644 --- a/lib/routes/bioone/journal.ts +++ b/lib/routes/bioone/journal.ts @@ -34,11 +34,7 @@ async function handler(ctx) { const rootUrl = 'https://bioone.org'; const currentUrl = `${rootUrl}/journals/${journal}/current`; - const response = await got(currentUrl, { - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(currentUrl); const $ = load(response.data); @@ -56,11 +52,7 @@ async function handler(ctx) { items = await Promise.all( items.map((item) => cache.tryGet(item.link, async () => { - const detailResponse = await got(item.link, { - https: { - rejectUnauthorized: false, - }, - }); + const detailResponse = await got(item.link); const content = load(detailResponse.data); diff --git a/lib/routes/biquge/index.ts b/lib/routes/biquge/index.ts index 817222c6c6..1160970c9d 100644 --- a/lib/routes/biquge/index.ts +++ b/lib/routes/biquge/index.ts @@ -42,13 +42,8 @@ async function handler(ctx) { throw new ConfigNotFoundError(`This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`); } - const response = await got({ - method: 'get', - url: currentUrl, + const response = await got(currentUrl, { responseType: 'buffer', - https: { - rejectUnauthorized: false, - }, }); const isGBK = /charset="?'?gb/i.test(response.data.toString()); @@ -86,13 +81,8 @@ async function handler(ctx) { items = await Promise.all( items.map((item) => cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: item.link, + const detailResponse = await got(item.link, { responseType: 'buffer', - https: { - rejectUnauthorized: false, - }, }); const content = load(iconv.decode(detailResponse.data, encoding)); diff --git a/lib/routes/bjsk/index.ts b/lib/routes/bjsk/index.ts index c89e2a7a62..c01bacdb5c 100644 --- a/lib/routes/bjsk/index.ts +++ b/lib/routes/bjsk/index.ts @@ -33,11 +33,7 @@ export const route: Route = { async function handler(ctx) { const { path = 'newslist-1486-0-0' } = ctx.req.param(); const link = `${baseUrl}/${path}.html`; - const { data: response } = await got(link, { - https: { - rejectUnauthorized: false, - }, - }); + const { data: response } = await got(link); const $ = load(response); const list = $('.article-list a') @@ -54,11 +50,7 @@ async function handler(ctx) { const items = await Promise.all( list.map((item) => cache.tryGet(item.link, async () => { - const { data: response } = await got(item.link, { - https: { - rejectUnauthorized: false, - }, - }); + const { data: response } = await got(item.link); const $ = load(response); item.description = $('.article-main').html(); item.author = $('.info') diff --git a/lib/routes/dgjyw/index.ts b/lib/routes/dgjyw/index.ts index 457ceef7fc..b4633b7062 100644 --- a/lib/routes/dgjyw/index.ts +++ b/lib/routes/dgjyw/index.ts @@ -20,13 +20,7 @@ async function handler(ctx) { const rootUrl = 'https://www.dgjyw.com'; const currentUrl = `${rootUrl}${params === '/' ? '/tz' : params}.htm`; - const response = await got({ - method: 'get', - url: currentUrl, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(currentUrl); const $ = load(response.data); @@ -48,13 +42,7 @@ async function handler(ctx) { items.map((item) => cache.tryGet(item.link, async () => { if (/dgjyw\.com/.test(item.link)) { - const detailResponse = await got({ - method: 'get', - url: item.link, - https: { - rejectUnauthorized: false, - }, - }); + const detailResponse = await got(item.link); const content = load(detailResponse.data); diff --git a/lib/routes/dol/announce.ts b/lib/routes/dol/announce.ts index d0e6863a4c..a76e5f44d7 100644 --- a/lib/routes/dol/announce.ts +++ b/lib/routes/dol/announce.ts @@ -66,11 +66,7 @@ async function handler(ctx) { result.link = `${baseUrl}/index.php?${new URLSearchParams(queryParams).toString()}`; - const { data: response } = await got(result.link, { - https: { - rejectUnauthorized: false, - }, - }); + const { data: response } = await got(result.link); const $ = load(response); result.item = $('div#div table tbody tr:not([class])') diff --git a/lib/routes/ecnu/jwc.ts b/lib/routes/ecnu/jwc.ts index cc323f252c..56d965a319 100644 --- a/lib/routes/ecnu/jwc.ts +++ b/lib/routes/ecnu/jwc.ts @@ -41,11 +41,7 @@ export const route: Route = { cache.tryGet(item.link, async () => { if (type(item.link) === 'htm') { try { - const { data } = await got(item.link, { - https: { - rejectUnauthorized: false, - }, - }); + const { data } = await got(item.link); const $ = load(data); item.description = $('div.article')?.html()?.replaceAll('src="/', `src="${baseUrl}/`)?.replaceAll('href="/', `href="${baseUrl}/`)?.trim(); return item; diff --git a/lib/routes/farmatters/index.tsx b/lib/routes/farmatters/index.tsx index 522efa3fda..0aa6118fdc 100644 --- a/lib/routes/farmatters/index.tsx +++ b/lib/routes/farmatters/index.tsx @@ -65,9 +65,6 @@ async function handler(ctx) { const { data: response } = await got(apiUrl, { searchParams, - https: { - rejectUnauthorized: false, - }, }); const items = response.data.list.slice(0, limit).map((item) => ({ @@ -89,11 +86,7 @@ async function handler(ctx) { pubDate: timezone(parseDate(item.createdAt), +8), })); - const { data: currentResponse } = await got(currentUrl, { - https: { - rejectUnauthorized: false, - }, - }); + const { data: currentResponse } = await got(currentUrl); const $ = load(currentResponse); diff --git a/lib/routes/furstar/archive.ts b/lib/routes/furstar/archive.ts index 17907b5642..95ad2bc7d1 100644 --- a/lib/routes/furstar/archive.ts +++ b/lib/routes/furstar/archive.ts @@ -31,11 +31,7 @@ export const route: Route = { async function handler(ctx) { const base = utils.langBase(ctx.req.param('lang')); const url = `${base}/archive.php`; - const res = await got.get(url, { - https: { - rejectUnauthorized: false, - }, - }); + const res = await got(url); const info = utils.fetchAllCharacters(res.data, base); return { diff --git a/lib/routes/furstar/artists.ts b/lib/routes/furstar/artists.ts index 8f6821104f..f235a01847 100644 --- a/lib/routes/furstar/artists.ts +++ b/lib/routes/furstar/artists.ts @@ -33,11 +33,7 @@ export const route: Route = { async function handler(ctx) { const base = utils.langBase(ctx.req.param('lang')); - const res = await got.get(base, { - https: { - rejectUnauthorized: false, - }, - }); + const res = await got(base); const $ = load(res.data); const artists = $('.filter-item') .toArray() diff --git a/lib/routes/furstar/index.ts b/lib/routes/furstar/index.ts index 016f469abc..d57a830989 100644 --- a/lib/routes/furstar/index.ts +++ b/lib/routes/furstar/index.ts @@ -31,11 +31,7 @@ export const route: Route = { async function handler(ctx) { const base = utils.langBase(ctx.req.param('lang')); - const res = await got.get(base, { - https: { - rejectUnauthorized: false, - }, - }); + const res = await got(base); const info = utils.fetchAllCharacters(res.data, base); const details = await Promise.all(info.map((e) => utils.detailPage(e.detailPage, cache))); diff --git a/lib/routes/furstar/utils.tsx b/lib/routes/furstar/utils.tsx index 4b5e67fe19..ec23c08288 100644 --- a/lib/routes/furstar/utils.tsx +++ b/lib/routes/furstar/utils.tsx @@ -52,11 +52,7 @@ const authorDetail = (el) => { const detailPage = (link, cache) => cache.tryGet(link, async () => { - const result = await got(link, { - https: { - rejectUnauthorized: false, - }, - }); + const result = await got(link); const $ = load(result.data); const title = $('.row .panel-heading h2').text().trim(); // Get first title const desc = $('.character-description p').text().trim(); diff --git a/lib/routes/gmu/news.ts b/lib/routes/gmu/news.ts index c845908cff..15c3446171 100644 --- a/lib/routes/gmu/news.ts +++ b/lib/routes/gmu/news.ts @@ -66,11 +66,7 @@ export async function handler(ctx: Context) { const baseUrl = 'https://gmu.cn'; const link = `${baseUrl}${newsType.url}`; - const response = await got(link, { - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(link); const $ = load(response.data); const list = $('.list ul li'); @@ -97,11 +93,7 @@ export async function handler(ctx: Context) { // Use cache.tryGet to cache the article content return await cache.tryGet(`gmu:news:${fullLink}`, async () => { try { - const contentResponse = await got(fullLink, { - https: { - rejectUnauthorized: false, - }, - }); + const contentResponse = await got(fullLink); const content = load(contentResponse.data); // 获取新闻内容 diff --git a/lib/routes/gmu/yjs.ts b/lib/routes/gmu/yjs.ts index b5964e1d99..2f9a295a34 100644 --- a/lib/routes/gmu/yjs.ts +++ b/lib/routes/gmu/yjs.ts @@ -97,11 +97,7 @@ export async function handler(ctx: Context) { const baseUrl = 'https://yjs.gmu.cn'; const link = baseUrl + path; - const response = await got(link, { - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(link); const $ = load(response.data); @@ -134,11 +130,7 @@ export async function handler(ctx: Context) { // Use cache.tryGet to cache the article content return await cache.tryGet(`gmu:yjs:${fullLink}`, async () => { try { - const contentResponse = await got(fullLink, { - https: { - rejectUnauthorized: false, - }, - }); + const contentResponse = await got(fullLink); const content = load(contentResponse.data); // 获取新闻内容 diff --git a/lib/routes/gov/nsfc/index.ts b/lib/routes/gov/nsfc/index.ts index 1ece4920b9..1c8415817b 100644 --- a/lib/routes/gov/nsfc/index.ts +++ b/lib/routes/gov/nsfc/index.ts @@ -32,11 +32,7 @@ async function handler(ctx) { const rootUrl = 'https://www.nsfc.gov.cn'; const currentUrl = new URL((/\/more$/.test(thePath) ? `${thePath}.htm` : thePath) || 'publish/portal0/tab442/', rootUrl).href; - const { data: response } = await got(currentUrl, { - https: { - rejectUnauthorized: false, - }, - }); + const { data: response } = await got(currentUrl); const $ = load(response); @@ -57,11 +53,7 @@ async function handler(ctx) { items = await Promise.all( items.map((item) => cache.tryGet(item.link, async () => { - const { data: detailResponse } = await got(item.link, { - https: { - rejectUnauthorized: false, - }, - }); + const { data: detailResponse } = await got(item.link); const content = load(detailResponse); diff --git a/lib/routes/gxmzu/utils/index.ts b/lib/routes/gxmzu/utils/index.ts index cf140186fe..386c73446a 100644 --- a/lib/routes/gxmzu/utils/index.ts +++ b/lib/routes/gxmzu/utils/index.ts @@ -6,7 +6,7 @@ import { parseDate } from '@/utils/parse-date'; import timezone from '@/utils/timezone'; async function getNoticeList(ctx, url, host, titleSelector, dateSelector, contentSelector) { - const response = await ofetch(url, { rejectUnauthorized: false }); + const response = await ofetch(url); if (!response) { return []; } @@ -33,7 +33,7 @@ async function getNoticeList(ctx, url, host, titleSelector, dateSelector, conten description: '该通知无法直接预览,请点击原文链接↑查看', }; } - const response = await ofetch(item.link, { rejectUnauthorized: false }); + const response = await ofetch(item.link); if (!response || (response.status >= 300 && response.status < 400)) { item.description = '该通知无法直接预览,请点击原文链接↑查看'; } else { diff --git a/lib/routes/gzhu/yjs.ts b/lib/routes/gzhu/yjs.ts index fee27438fa..5e1566941d 100644 --- a/lib/routes/gzhu/yjs.ts +++ b/lib/routes/gzhu/yjs.ts @@ -30,11 +30,7 @@ export const route: Route = { async function handler() { const link = 'https://yjsy.gzhu.edu.cn/zsxx/zsdt/zsdt.htm'; - const response = await got(link, { - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(link); const $ = load(response.data); const list = $('.picnews_cont li'); diff --git a/lib/routes/hitwh/today.ts b/lib/routes/hitwh/today.ts index fa759b865a..c08a893cd5 100644 --- a/lib/routes/hitwh/today.ts +++ b/lib/routes/hitwh/today.ts @@ -33,11 +33,7 @@ export const route: Route = { }; async function handler() { - const response = await got(`${baseUrl}/1024/list.htm`, { - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(`${baseUrl}/1024/list.htm`); const $ = load(response.data); const type = (filename) => filename.split('.').pop(); const links = $('.list_list_wrap #wp_news_w10002 ul > li') @@ -56,11 +52,7 @@ async function handler() { cache.tryGet(item.link, async () => { if (type(item.link) === 'htm') { try { - const { data } = await got(item.link, { - https: { - rejectUnauthorized: false, - }, - }); + const { data } = await got(item.link); const $ = load(data); item.description = $('div.wp_articlecontent').html() && $('div.wp_articlecontent').html().replaceAll('src="/', `src="${baseUrl}/`).replaceAll('href="/', `href="${baseUrl}/`).trim(); return item; diff --git a/lib/routes/hunau/utils/news-content.ts b/lib/routes/hunau/utils/news-content.ts index c455c362d4..551f1855be 100644 --- a/lib/routes/hunau/utils/news-content.ts +++ b/lib/routes/hunau/utils/news-content.ts @@ -7,11 +7,7 @@ import timezone from '@/utils/timezone'; async function newsContent(link, department = '') { try { // 异步请求文章 - const { data: response } = await got(link, { - https: { - rejectUnauthorized: false, - }, - }); + const { data: response } = await got(link); // 加载文章内容 const $ = load(response); let reg = /\d{4}(?:\/\d{2}){2}/; diff --git a/lib/routes/jsu/utils/index.ts b/lib/routes/jsu/utils/index.ts index cb228ec0a3..1868fe6b4e 100644 --- a/lib/routes/jsu/utils/index.ts +++ b/lib/routes/jsu/utils/index.ts @@ -9,11 +9,7 @@ import got from '@/utils/got'; // 自订的 got * @returns {Promise} 页面内容,为符合RSS规范的HTML */ async function getPageItem(selector, pageUrl) { - const response = await got({ - method: 'get', - url: pageUrl, - https: { rejectUnauthorized: false }, - }); + const response = await got(pageUrl); const $ = load(response.data); const page = $(selector); return page ? page.html() : '无法获取内容'; @@ -29,11 +25,7 @@ async function getPageItem(selector, pageUrl) { * @returns {Promise<{date, pageInfo: string, title: (*|jQuery|string)}|{date: string, pageInfo: string, title: string}>} 页面内容、标题、日期 */ async function getPageDetails(selector, pageUrl, titleSelector, dateSelector, dateHander = (date) => date) { - const response = await got({ - method: 'get', - url: pageUrl, - https: { rejectUnauthorized: false }, - }); + const response = await got(pageUrl); const $ = load(response.data); const page = $(selector); const date = dateHander($(dateSelector).text()); diff --git a/lib/routes/njit/jwc.ts b/lib/routes/njit/jwc.ts index f1e1656be2..397286b570 100644 --- a/lib/routes/njit/jwc.ts +++ b/lib/routes/njit/jwc.ts @@ -31,13 +31,7 @@ export const route: Route = { async function handler(ctx) { const type = ctx.req.param('type') ?? 'jx'; const link = host + '/index/' + type + '.htm'; - const response = await got({ - method: 'get', - url: link, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(link); const $ = load(response.body); const urlList = $('body') @@ -59,13 +53,7 @@ async function handler(ctx) { itemUrl = new URL(itemUrl, host).href; if (itemUrl.includes('.htm')) { return cache.tryGet(itemUrl, async () => { - const response = await got({ - method: 'get', - url: itemUrl, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(itemUrl); if (response.redirectUrls.length !== 0) { const single = { title: titleList[index], diff --git a/lib/routes/njit/tzgg.ts b/lib/routes/njit/tzgg.ts index 66a7ef61dc..e6345bb333 100644 --- a/lib/routes/njit/tzgg.ts +++ b/lib/routes/njit/tzgg.ts @@ -33,13 +33,7 @@ export const route: Route = { }; async function handler() { - const response = await got({ - method: 'get', - url, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(url); const $ = load(response.body); const urlList = $('body') @@ -70,13 +64,7 @@ async function handler() { return single; } else { return cache.tryGet(itemUrl, async () => { - const response = await got({ - method: 'get', - url: itemUrl, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(itemUrl); const $ = load(response.body); const single = { title: $('title').text(), diff --git a/lib/routes/njnu/ceai/ceai.ts b/lib/routes/njnu/ceai/ceai.ts index fa8fb40f69..de542bfc1e 100644 --- a/lib/routes/njnu/ceai/ceai.ts +++ b/lib/routes/njnu/ceai/ceai.ts @@ -48,13 +48,7 @@ async function handler(ctx) { } const base = 'http://ceai.njnu.edu.cn/Item/List.asp?ID=' + path; - const response = await got({ - method: 'get', - url: base, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(base); const $ = load(response.data); diff --git a/lib/routes/njnu/ceai/utils.ts b/lib/routes/njnu/ceai/utils.ts index 06aad5b0c1..538ba82fce 100644 --- a/lib/routes/njnu/ceai/utils.ts +++ b/lib/routes/njnu/ceai/utils.ts @@ -7,11 +7,7 @@ import timezone from '@/utils/timezone'; // 专门定义一个function用于加载文章内容 async function loadContent(link) { // 异步请求文章 - const response = await got.get(link, { - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(link); // 加载文章内容 const $ = load(response.data); const dateStr = $('#xw_xinxi span:nth-child(1)').text(); diff --git a/lib/routes/njnu/jwc/jwc.ts b/lib/routes/njnu/jwc/jwc.ts index 9df6aa2b2d..c7417ac1c4 100644 --- a/lib/routes/njnu/jwc/jwc.ts +++ b/lib/routes/njnu/jwc/jwc.ts @@ -48,13 +48,7 @@ async function handler(ctx) { } const base = 'http://jwc.njnu.edu.cn/index/' + path; - const response = await got({ - method: 'get', - url: base, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(base); const $ = load(response.data); diff --git a/lib/routes/njnu/jwc/utils.ts b/lib/routes/njnu/jwc/utils.ts index d727ed95e7..74336a9144 100644 --- a/lib/routes/njnu/jwc/utils.ts +++ b/lib/routes/njnu/jwc/utils.ts @@ -7,11 +7,7 @@ import timezone from '@/utils/timezone'; // 专门定义一个function用于加载文章内容 async function loadContent(link) { // 异步请求文章 - const response = await got.get(link, { - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(link); // 加载文章内容 const $ = load(response.data); const dateStr = $('span+ span').text(); diff --git a/lib/routes/nua/utils.ts b/lib/routes/nua/utils.ts index 9e00603a9b..b793a54308 100644 --- a/lib/routes/nua/utils.ts +++ b/lib/routes/nua/utils.ts @@ -25,7 +25,7 @@ function arti_link(text, href) { } async function ProcessList(newsUrl, baseUrl, listName, listDate, webPageName) { - const result = await got(newsUrl, { https: { rejectUnauthorized: false } }); + const result = await got(newsUrl); const $ = load(result.data); const pageName = $(webPageName).text().trim(); @@ -54,7 +54,7 @@ const ProcessFeed = (items, artiContent) => switch (item.type) { case 'in-nua': case 'nua': { - const result = await got(item.link, { https: { rejectUnauthorized: false } }); + const result = await got(item.link); const $ = load(result.data); item.author = $('.arti_publisher').text() + ' ' + $('.arti_views').text(); item.description = $(artiContent).html(); diff --git a/lib/routes/pku/nsd.ts b/lib/routes/pku/nsd.ts index a72fe87e1c..7dff35cb12 100644 --- a/lib/routes/pku/nsd.ts +++ b/lib/routes/pku/nsd.ts @@ -47,7 +47,7 @@ export const route: Route = { }; async function handler() { - const response = await got({ url: baseUrl, https: { rejectUnauthorized: false } }); + const response = await got(baseUrl); const $ = load(response.data); const list = $('div.maincontent > ul > li') @@ -70,14 +70,14 @@ async function handler() { return finishArticleItem(item); case 'pku-news': return cache.tryGet(item.link, async () => { - const detailResponse = await got({ url: item.link, https: { rejectUnauthorized: false } }); + const detailResponse = await got(item.link); const content = load(detailResponse.data); item.description = content('div.pageArticle > div.col.lf').html(); return item; }); case 'in-site': return cache.tryGet(item.link, async () => { - const detailResponse = await got({ url: item.link, https: { rejectUnauthorized: false } }); + const detailResponse = await got(item.link); const content = load(detailResponse.data); item.description = content('div.article').html(); return item; diff --git a/lib/routes/pumc/mdadmission.ts b/lib/routes/pumc/mdadmission.ts index da0ce1f2ab..444a88e3bd 100644 --- a/lib/routes/pumc/mdadmission.ts +++ b/lib/routes/pumc/mdadmission.ts @@ -35,13 +35,7 @@ async function handler(ctx) { const rootUrl = 'https://mdadmission.pumc.edu.cn'; const currentUrl = `${rootUrl}/mdweb/site!noticeList?param.infoTypeId=&rows=${limit}&pages=1`; - const response = await got({ - method: 'get', - url: currentUrl, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(currentUrl); const $ = load(response.data); @@ -62,13 +56,7 @@ async function handler(ctx) { items = await Promise.all( items.map((item) => cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: item.link, - https: { - rejectUnauthorized: false, - }, - }); + const detailResponse = await got(item.link); const content = load(detailResponse.data); diff --git a/lib/routes/qipamaijia/index.ts b/lib/routes/qipamaijia/index.ts index 3b188907d7..760bd81a30 100644 --- a/lib/routes/qipamaijia/index.ts +++ b/lib/routes/qipamaijia/index.ts @@ -35,13 +35,7 @@ async function handler(ctx) { const cate = ctx.req.param('cate') ?? ''; const url = `${rootUrl}/${cate}`; - const response = await got({ - method: 'get', - url, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(url); const $ = load(response.data); const title = $('#highlight').text(); const items = $('div.col_l > div.block') diff --git a/lib/routes/shmtu/jwc.ts b/lib/routes/shmtu/jwc.ts index e588409ee9..17660818a1 100644 --- a/lib/routes/shmtu/jwc.ts +++ b/lib/routes/shmtu/jwc.ts @@ -9,7 +9,7 @@ import timezone from '@/utils/timezone'; const host = 'https://jwc.shmtu.edu.cn'; async function loadContent(link) { - const response = await got(link, { https: { rejectUnauthorized: false } }); + const response = await got(link); const $ = load(response.data); return $('.wp_articlecontent').html(); @@ -59,7 +59,6 @@ async function handler(ctx) { headers: { Referer: host, }, - https: { rejectUnauthorized: false }, }); const $ = load(response.data); diff --git a/lib/routes/shmtu/portal.tsx b/lib/routes/shmtu/portal.tsx index 499d64891a..f8a967fba8 100644 --- a/lib/routes/shmtu/portal.tsx +++ b/lib/routes/shmtu/portal.tsx @@ -16,7 +16,6 @@ const loadDetail = async (link) => { form: { interfaceUrl: link, }, - https: { rejectUnauthorized: false }, }); return JSON.parse(response.data); @@ -120,7 +119,6 @@ async function handler(ctx) { form: { interfaceUrl: `${host}/${type}.json?page=0`, }, - https: { rejectUnauthorized: false }, }); const list = JSON.parse(response.data).map((item) => ({ diff --git a/lib/routes/shmtu/www.ts b/lib/routes/shmtu/www.ts index b7480eff6e..51e02caf52 100644 --- a/lib/routes/shmtu/www.ts +++ b/lib/routes/shmtu/www.ts @@ -8,7 +8,7 @@ import { parseDate } from '@/utils/parse-date'; const host = 'https://www.shmtu.edu.cn'; async function loadContent(link) { - const response = await got.get(link, { https: { rejectUnauthorized: false } }); + const response = await got(link); const $ = load(response.data); return $('article').html(); @@ -59,7 +59,6 @@ async function handler(ctx) { headers: { Referer: host, }, - https: { rejectUnauthorized: false }, }); const $ = load(response.data); diff --git a/lib/routes/stbu/jsjxy.ts b/lib/routes/stbu/jsjxy.ts index d386d393dd..675a25e792 100644 --- a/lib/routes/stbu/jsjxy.ts +++ b/lib/routes/stbu/jsjxy.ts @@ -42,9 +42,6 @@ async function handler() { const baseUrl = 'https://jsjxy.stbu.edu.cn/news/'; const { data: response } = await got(baseUrl, { responseType: 'buffer', - https: { - rejectUnauthorized: false, - }, }); const $ = load(gbk2utf8(response)); const list = $('.content dl h4') @@ -63,9 +60,6 @@ async function handler() { cache.tryGet(item.link, async () => { const { data: response } = await got(item.link, { responseType: 'buffer', - https: { - rejectUnauthorized: false, - }, }); const $ = load(gbk2utf8(response)); item.description = $('.content14').first().html().trim(); diff --git a/lib/routes/stbu/xyxw.ts b/lib/routes/stbu/xyxw.ts index 4a85d24af8..3647602f0e 100644 --- a/lib/routes/stbu/xyxw.ts +++ b/lib/routes/stbu/xyxw.ts @@ -37,9 +37,6 @@ async function handler() { const requestUrl = `${baseUrl}/html/news/xueyuan/`; const { data: response } = await got(requestUrl, { responseType: 'buffer', - https: { - rejectUnauthorized: false, - }, }); const $ = load(gbk2utf8(response)); const list = $('.style_2 .Simple_title') @@ -58,9 +55,6 @@ async function handler() { cache.tryGet(item.link, async () => { const { data: response } = await got(item.link, { responseType: 'buffer', - https: { - rejectUnauthorized: false, - }, }); const $ = load(gbk2utf8(response)); item.description = $('.artmainl .articlemain').first().html(); diff --git a/lib/routes/tju/oaa/index.ts b/lib/routes/tju/oaa/index.ts index b65e2872a5..90e9420c4c 100644 --- a/lib/routes/tju/oaa/index.ts +++ b/lib/routes/tju/oaa/index.ts @@ -112,7 +112,7 @@ async function handler(ctx) { return cache.tryGet(item.link, async () => { let detailResponse = null; try { - detailResponse = await got(item.link, { https: { rejectUnauthorized: false } }); + detailResponse = await got(item.link); const content = load(detailResponse.data); item.description = content('.v_news_content').html(); } catch { diff --git a/lib/routes/xidian/cs.ts b/lib/routes/xidian/cs.ts index 87d71ef123..443b6a2608 100644 --- a/lib/routes/xidian/cs.ts +++ b/lib/routes/xidian/cs.ts @@ -99,9 +99,6 @@ async function handler(ctx) { headers: { referer: baseUrl, }, - https: { - rejectUnauthorized: false, - }, }); const $ = load(response.data); @@ -124,9 +121,6 @@ async function handler(ctx) { headers: { referer: url, }, - https: { - rejectUnauthorized: false, - }, }); const content = load(detailResponse.data); content('.content-sxt').remove(); diff --git a/lib/routes/xidian/gr.ts b/lib/routes/xidian/gr.ts index 09c20a6902..614f92bab4 100644 --- a/lib/routes/xidian/gr.ts +++ b/lib/routes/xidian/gr.ts @@ -231,9 +231,6 @@ async function handler(ctx) { headers: { referer: baseUrl, }, - https: { - rejectUnauthorized: false, - }, }); const $ = load(response.data); @@ -269,9 +266,6 @@ async function handler(ctx) { headers: { referer: url, }, - https: { - rejectUnauthorized: false, - }, }); const content = load(detailResponse.data); content('.content-sxt').remove(); diff --git a/lib/routes/xidian/jwc.ts b/lib/routes/xidian/jwc.ts index 2efaad3e5d..fb10f8d57d 100644 --- a/lib/routes/xidian/jwc.ts +++ b/lib/routes/xidian/jwc.ts @@ -36,9 +36,6 @@ async function handler(ctx) { headers: { referer: baseUrl, }, - https: { - rejectUnauthorized: false, - }, }); const $ = load(response.data); @@ -60,9 +57,6 @@ async function handler(ctx) { headers: { referer: url, }, - https: { - rejectUnauthorized: false, - }, }); const content = load(detailResponse.data); content('.tit, .zd, #div_vote_id').remove(); diff --git a/lib/routes/xjtu/job.tsx b/lib/routes/xjtu/job.tsx index ed73c61d75..9d953bbe3b 100644 --- a/lib/routes/xjtu/job.tsx +++ b/lib/routes/xjtu/job.tsx @@ -45,9 +45,6 @@ async function handler(ctx) { form: { requestParamStr: '{"pageSize":7,"pageNumber":1}', }, - https: { - rejectUnauthorized: false, - }, }); const menuid = getTzgg.data.data.find((item) => item.menutitle === arr[subpath]).menuid; @@ -55,9 +52,6 @@ async function handler(ctx) { form: { requestParamStr: `{"pageSize":4,"pageNumber":1,"LMDM":${menuid}}`, }, - https: { - rejectUnauthorized: false, - }, }); const list = data.data.map((item) => ({ title: item.menutitle, @@ -74,18 +68,11 @@ async function handler(ctx) { form: { requestParamStr: `{"WID":${item.guid}}`, }, - https: { - rejectUnauthorized: false, - }, }); let attachments = ''; if (response.data.data[0].FJ) { - const attachmentData = await got(`${baseUrl}/xsfw/sys/emapcomponent/file/getUploadedAttachment.do?fileToken=${response.data.data[0].FJ}`, { - https: { - rejectUnauthorized: false, - }, - }); + const attachmentData = await got(`${baseUrl}/xsfw/sys/emapcomponent/file/getUploadedAttachment.do?fileToken=${response.data.data[0].FJ}`); attachments = renderToString(); } diff --git a/lib/routes/xmut/jwc/bkjw.ts b/lib/routes/xmut/jwc/bkjw.ts index 5843d58f0b..5d95dd29b9 100644 --- a/lib/routes/xmut/jwc/bkjw.ts +++ b/lib/routes/xmut/jwc/bkjw.ts @@ -21,9 +21,6 @@ async function handler(ctx) { headers: { referer: xmut, }, - https: { - rejectUnauthorized: false, - }, }); const $ = load(res.data); const itemsArray = $('#result_list table tbody tr') @@ -54,9 +51,6 @@ async function handler(ctx) { headers: { referer: xmut, }, - https: { - rejectUnauthorized: false, - }, }); const $item = load(res.data); const content = $item('table #result #content form div #vsb_content_6').html(); diff --git a/lib/routes/xmut/jwc/yjs.ts b/lib/routes/xmut/jwc/yjs.ts index d9e2108338..8d0ee5008c 100644 --- a/lib/routes/xmut/jwc/yjs.ts +++ b/lib/routes/xmut/jwc/yjs.ts @@ -21,9 +21,6 @@ async function handler(ctx) { headers: { referer: xmut, }, - https: { - rejectUnauthorized: false, - }, }); const $ = load(res.data); const items = $('.mainWrap .main_con .main_conR ul li') @@ -43,9 +40,6 @@ async function handler(ctx) { headers: { referer: xmut, }, - https: { - rejectUnauthorized: false, - }, }); const $item = load(detailResponse.data); const content = $item('body .mainWrap .main_content .v_news_content').html(); diff --git a/lib/routes/zimuxia/index.ts b/lib/routes/zimuxia/index.ts index e1e3051cbb..cc95e10256 100644 --- a/lib/routes/zimuxia/index.ts +++ b/lib/routes/zimuxia/index.ts @@ -30,15 +30,10 @@ async function handler(ctx) { const rootUrl = 'https://www.zimuxia.cn'; const currentUrl = `${rootUrl}/我们的作品`; - const response = await got({ - method: 'get', - url: currentUrl, + const response = await got(currentUrl, { searchParams: { cat: category ?? undefined, }, - https: { - rejectUnauthorized: false, - }, }); const $ = load(response.data); @@ -57,13 +52,7 @@ async function handler(ctx) { const items = await Promise.all( list.map((item) => cache.tryGet(item.link, async () => { - const detailResponse = await got({ - method: 'get', - url: item.link, - https: { - rejectUnauthorized: false, - }, - }); + const detailResponse = await got(item.link); const content = load(detailResponse.data); const links = detailResponse.data.match(/磁力下载<\/a>/g); diff --git a/lib/routes/zimuxia/portfolio.ts b/lib/routes/zimuxia/portfolio.ts index b2c127d8d3..76d9e201ed 100644 --- a/lib/routes/zimuxia/portfolio.ts +++ b/lib/routes/zimuxia/portfolio.ts @@ -39,13 +39,7 @@ async function handler(ctx) { const rootUrl = 'https://www.zimuxia.cn'; const currentUrl = `${rootUrl}/portfolio/${id}`; - const response = await got({ - method: 'get', - url: currentUrl, - https: { - rejectUnauthorized: false, - }, - }); + const response = await got(currentUrl); const $ = load(response.data);