fix(route): remove rejectUnauthorized option (#20864)

ofetch and undici simply ignore it
This commit is contained in:
Tony
2026-01-13 10:35:10 +08:00
committed by GitHub
parent af2592b10a
commit b22fdd8c91
51 changed files with 66 additions and 395 deletions
@@ -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');
@@ -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 = {
@@ -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();
+2 -13
View File
@@ -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,
},
+2 -13
View File
@@ -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,
},
+2 -13
View File
@@ -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,
},
+2 -13
View File
@@ -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,
},
+2 -10
View File
@@ -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();
+2 -10
View File
@@ -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);
+2 -12
View File
@@ -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));
+2 -10
View File
@@ -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')
+2 -14
View File
@@ -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);
+1 -5
View File
@@ -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])')
+1 -5
View File
@@ -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;
+1 -8
View File
@@ -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);
+1 -5
View File
@@ -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 {
+1 -5
View File
@@ -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()
+1 -5
View File
@@ -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)));
+1 -5
View File
@@ -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();
+2 -10
View File
@@ -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);
// 获取新闻内容
+2 -10
View File
@@ -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);
// 获取新闻内容
+2 -10
View File
@@ -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);
+2 -2
View File
@@ -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 {
+1 -5
View File
@@ -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');
+2 -10
View File
@@ -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;
+1 -5
View File
@@ -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}/;
+2 -10
View File
@@ -9,11 +9,7 @@ import got from '@/utils/got'; // 自订的 got
* @returns {Promise<string|string>} 页面内容,为符合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());
+2 -14
View File
@@ -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],
+2 -14
View File
@@ -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(),
+1 -7
View File
@@ -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);
+1 -5
View File
@@ -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();
+1 -7
View File
@@ -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);
+1 -5
View File
@@ -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();
+2 -2
View File
@@ -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();
+3 -3
View File
@@ -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;
+2 -14
View File
@@ -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);
+1 -7
View File
@@ -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')
+1 -2
View File
@@ -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);
-2
View File
@@ -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) => ({
+1 -2
View File
@@ -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);
-6
View File
@@ -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();
-6
View File
@@ -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();
+1 -1
View File
@@ -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 {
-6
View File
@@ -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();
-6
View File
@@ -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();
-6
View File
@@ -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();
+1 -14
View File
@@ -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(<XjtuAttachments items={attachmentData.data.items} />);
}
-6
View File
@@ -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();
-6
View File
@@ -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();
+2 -13
View File
@@ -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 href="magnet:(.*?)" target="_blank">磁力下载<\/a>/g);
+1 -7
View File
@@ -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);