From 6d16623f36b32724a782aa3581813c5e90733e8f Mon Sep 17 00:00:00 2001 From: Jurangren Date: Sat, 23 Aug 2025 01:01:06 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=A0=87=E5=87=86=E5=8C=96=202dfan=20?= =?UTF-8?q?API=20HTML=20=E5=93=8D=E5=BA=94=E6=97=A5=E5=BF=97=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 `VikaACG` 和 `TWOdfan` 平台中,标准化 2dfan API HTML 响应的日志格式。 - 日志输出采用 JSON 格式,包含 `message`、`html` 和 `level: "info"` 字段。 - 此更改有助于改进 API 响应的调试和监控。 --- src/platforms/gal/VikaACG.ts | 6 ++++++ src/platforms/patch/TWOdfan.ts | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/platforms/gal/VikaACG.ts b/src/platforms/gal/VikaACG.ts index a6e9d8b..ebc1575 100644 --- a/src/platforms/gal/VikaACG.ts +++ b/src/platforms/gal/VikaACG.ts @@ -48,6 +48,12 @@ async function searchVikaACG(game: string): Promise { // The response is a JSON-encoded string containing HTML. // .json() will parse the JSON and unescape the string content. const html: string = await response.text(); + + console.log(JSON.stringify({ + message: "2dfan API HTML Response", + html: html, + level: "info", + })); const matches = html.matchAll(REGEX); diff --git a/src/platforms/patch/TWOdfan.ts b/src/platforms/patch/TWOdfan.ts index c445f12..d4fb0d1 100644 --- a/src/platforms/patch/TWOdfan.ts +++ b/src/platforms/patch/TWOdfan.ts @@ -24,8 +24,12 @@ async function searchTWOdfan(game: string): Promise { if (!response.ok) { throw new Error(`资源平台 SearchAPI 响应异常状态码 ${response.status}`); } - - console.log("2dfan API HTML Response:", response.text()); + + console.log(JSON.stringify({ + message: "2dfan API HTML Response", + html: response.text(), + level: "info", + })); const data = await response.json() as TwoDFanResponse; const html = data.subjects;