fix(route): jpxgmn (#15118)

This commit is contained in:
Urabartin 2024-04-05 21:17:00 +08:00 committed by GitHub
parent 0e11352797
commit 860d7ad45f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
import { Route } from '@/types';
import { originUrl, getArticleDesc } from './utils';
import cache from '@/utils/cache';
import got from '@/utils/got';
import ofetch from '@/utils/ofetch';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
@ -18,9 +18,9 @@ export const route: Route = {
async function handler(ctx) {
const { kw } = ctx.req.param();
const searchUrl = originUrl + `/plus/search/index.asp?keyword=${kw}`;
const response = await got(searchUrl);
const response = await ofetch.raw(searchUrl);
const baseUrl = new URL(response.url).origin;
const $ = load(response.data);
const $ = load(response._data);
const items = $('div.list div.list div.node p')
.toArray()
.map((item) => ({

View File

@ -1,7 +1,7 @@
import { Route } from '@/types';
import { originUrl, getArticleDesc } from './utils';
import cache from '@/utils/cache';
import got from '@/utils/got';
import ofetch from '@/utils/ofetch';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
@ -25,9 +25,9 @@ async function handler(ctx) {
const { tab = 'top' } = ctx.req.param();
const isSpecial = ['new', 'top', 'hot'].includes(tab);
const tabUrl = `${originUrl}/${tab}` + (isSpecial ? '.html' : '/');
const response = await got(tabUrl);
const response = await ofetch.raw(tabUrl);
const baseUrl = new URL(response.url).origin;
const $ = load(response.data);
const $ = load(response._data);
const topTitle = $('div.toptip > a').get(1);
let feedTitle = $('title').text();
if (isSpecial) {

View File

@ -1,7 +1,7 @@
import { Route } from '@/types';
import { originUrl, getArticleDesc } from './utils';
import cache from '@/utils/cache';
import got from '@/utils/got';
import ofetch from '@/utils/ofetch';
import { load } from 'cheerio';
import { parseDate } from '@/utils/parse-date';
@ -21,9 +21,9 @@ export const route: Route = {
};
async function handler() {
const response = await got(originUrl);
const response = await ofetch.raw(originUrl);
const baseUrl = new URL(response.url).origin;
const $ = load(response.data);
const $ = load(response._data);
const items = $('aside div:nth-child(2) li')
.toArray()
.map((item) => {