fix: 修复 VikaACG 名称抓取,并调整调试日志

*   修复 VikaACG 平台中提取游戏名称的正则表达式,提高匹配准确性。
*   移除 Koyso 平台中不再需要的调试日志输出,优化代码。
*   在 TWOdfan 平台中新增调试日志,以便检查 API 响应的 HTML 内容。
This commit is contained in:
Jurangren
2025-08-22 00:52:34 +08:00
parent 5b37aacd8c
commit 1a9db6a536
3 changed files with 3 additions and 4 deletions

View File

@@ -22,9 +22,6 @@ async function searchKoyso(game: string): Promise<PlatformSearchResult> {
} }
const html = await response.text(); const html = await response.text();
// --- DEBUGGING: Print the full HTML content ---
console.log("Koyso API HTML Response:", html);
// --- END DEBUGGING ---
const matches = html.matchAll(REGEX); const matches = html.matchAll(REGEX);

View File

@@ -6,7 +6,7 @@ const API_URL = "https://www.vikacg.com/wp-json/b2/v1/getPostList";
// The Python code suggests the response text itself might be a JSON string // The Python code suggests the response text itself might be a JSON string
// that contains escaped HTML. Let's try to parse it as JSON first. // that contains escaped HTML. Let's try to parse it as JSON first.
// The regex is applied to the *unescaped* string. // The regex is applied to the *unescaped* string.
const REGEX = /<h2><a target="_blank" href="(?<URL>.*?)" title="(?<NAME>.*?)"/gs; const REGEX = /<h2><a target="_blank" href="(?<URL>.*?)">(?<NAME>.*?)<"/gs;
async function searchVikaACG(game: string): Promise<PlatformSearchResult> { async function searchVikaACG(game: string): Promise<PlatformSearchResult> {
const searchResult: PlatformSearchResult = { const searchResult: PlatformSearchResult = {

View File

@@ -27,6 +27,8 @@ async function searchTWOdfan(game: string): Promise<PlatformSearchResult> {
const data = await response.json() as TwoDFanResponse; const data = await response.json() as TwoDFanResponse;
const html = data.subjects; const html = data.subjects;
console.log("2dfan API HTML Response:", html);
const matches = html.matchAll(REGEX); const matches = html.matchAll(REGEX);