From 39e1f779a13cd947ec3cb44366ef043716d88008 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 18 Jun 2025 07:48:08 +0800 Subject: [PATCH] fix(route/copymanga): fix comic (#19401) --- lib/routes/copymanga/comic.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/routes/copymanga/comic.ts b/lib/routes/copymanga/comic.ts index be2093b7c..f729637b2 100644 --- a/lib/routes/copymanga/comic.ts +++ b/lib/routes/copymanga/comic.ts @@ -2,7 +2,7 @@ import { Route } from '@/types'; import cache from '@/utils/cache'; import { load } from 'cheerio'; -import got from '@/utils/got'; +import ofetch from '@/utils/ofetch'; import { parseDate } from '@/utils/parse-date'; import { art } from '@/utils/render'; import path from 'node:path'; @@ -48,11 +48,11 @@ async function handler(ctx) { do { bHasNextPage = false; // eslint-disable-next-line no-await-in-loop - const { data } = await got(strBaseUrl, { + const data = await ofetch(strBaseUrl, { headers: { - platform: 1, + platform: '', }, - searchParams: { + query: { limit: iReqLimit, offset: iReqOffSet, }, @@ -92,7 +92,7 @@ async function handler(ctx) { // 获取漫画标题、介绍 const { bookTitle, bookIntro } = await cache.tryGet(`${baseUrl}/comic/${id}`, async () => { - const { data } = await got(`${baseUrl}/comic/${id}`); + const data = await ofetch(`${baseUrl}/comic/${id}`); const $ = load(data); return { bookTitle: $('.comicParticulars-title-right > ul > li > h6').text(), @@ -101,11 +101,9 @@ async function handler(ctx) { }); const genResult = async (chapter) => { - const { - data: { code, results }, - } = await got(`${apiBaseUrl}/api/v3/comic/${id}/chapter/${chapter.uuid}`, { + const { code, results } = await ofetch(`${apiBaseUrl}/api/v3/comic/${id}/chapter/${chapter.uuid}`, { headers: { - webp: 1, + webp: '1', }, });