From 7649390852d695db50ff9d6faa37d4a55220227d Mon Sep 17 00:00:00 2001 From: gdjdkid <67935269+gdjdkid@users.noreply.github.com> Date: Sat, 21 Mar 2026 11:12:09 +0800 Subject: [PATCH] Fix: Add FC2 format search logic --- lib/fetcher.js | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/fetcher.js b/lib/fetcher.js index 365f26c..723cb83 100644 --- a/lib/fetcher.js +++ b/lib/fetcher.js @@ -2,6 +2,7 @@ import { execSync } from 'child_process'; import * as cheerio from 'cheerio'; import { getCache, setCache, getConfig } from './cache.js'; import { writeFileSync, unlinkSync } from 'fs'; +import chalk from 'chalk'; // ─── 通用请求函数 ──────────────────────────────────────── function fetchHtml(url, cookie = '') { @@ -262,6 +263,12 @@ function parseJavdb(html, queryId) { // ─── 主入口:依次尝试三个数据源 ───────────────────────── export async function search(id) { + // 自动识别 FC2 格式:031926_100 → FC2-031926 + if (/^\d{5,6}_\d+$/.test(id)) { + id = `FC2-${id.split('_')[0]}`; + console.log(chalk.gray(` FC2番号已转换为: ${id}`)); + } + const cached = getCache(id); if (cached) return cached; diff --git a/package.json b/package.json index 54391f7..30ac86e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "javinfo", - "version": "1.1.3", + "version": "1.1.4", "description": "AV番号命令行查询工具", "main": "./index.js", "type": "module",