From 860d7ad45f6d708ae790d38c63cedff4bef027df Mon Sep 17 00:00:00 2001 From: Urabartin <162798205+Urabartin@users.noreply.github.com> Date: Fri, 5 Apr 2024 21:17:00 +0800 Subject: [PATCH] fix(route): jpxgmn (#15118) --- lib/routes/jpxgmn/search.ts | 6 +++--- lib/routes/jpxgmn/tab.ts | 6 +++--- lib/routes/jpxgmn/weekly.ts | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/routes/jpxgmn/search.ts b/lib/routes/jpxgmn/search.ts index 666739dd0..e2e6a8f97 100644 --- a/lib/routes/jpxgmn/search.ts +++ b/lib/routes/jpxgmn/search.ts @@ -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) => ({ diff --git a/lib/routes/jpxgmn/tab.ts b/lib/routes/jpxgmn/tab.ts index 990731aa4..a94b334cc 100644 --- a/lib/routes/jpxgmn/tab.ts +++ b/lib/routes/jpxgmn/tab.ts @@ -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) { diff --git a/lib/routes/jpxgmn/weekly.ts b/lib/routes/jpxgmn/weekly.ts index cf3ea9efa..71708ae56 100644 --- a/lib/routes/jpxgmn/weekly.ts +++ b/lib/routes/jpxgmn/weekly.ts @@ -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) => {