mirror of
https://github.com/Moe-Sakura/Wrangler-API.git
synced 2026-03-15 04:13:18 +08:00
chore: 标准化 2dfan API HTML 响应日志格式
- 在 `VikaACG` 和 `TWOdfan` 平台中,标准化 2dfan API HTML 响应的日志格式。 - 日志输出采用 JSON 格式,包含 `message`、`html` 和 `level: "info"` 字段。 - 此更改有助于改进 API 响应的调试和监控。
This commit is contained in:
@@ -48,6 +48,12 @@ async function searchVikaACG(game: string): Promise<PlatformSearchResult> {
|
||||
// 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);
|
||||
|
||||
|
||||
@@ -24,8 +24,12 @@ async function searchTWOdfan(game: string): Promise<PlatformSearchResult> {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user