diff --git a/lib/fetcher.js b/lib/fetcher.js index 60037dd..765d324 100644 --- a/lib/fetcher.js +++ b/lib/fetcher.js @@ -177,7 +177,9 @@ function searchJavdb(id) { $('.movie-list .item a.box').each((_, el) => { const foundId = $(el).find('.video-title strong').text().trim().toUpperCase(); - if (foundId === id.toUpperCase()) { + // 比较时统一把连字符和下划线都当成同一个字符处理 + const normalize = s => s.replace(/[-_]/g, ''); + if (normalize(foundId) === normalize(id.toUpperCase())) { detailPath = $(el).attr('href'); return false; } @@ -263,10 +265,9 @@ function parseJavdb(html, queryId) { // ─── 主入口:依次尝试三个数据源 ───────────────────────── export async function search(id) { - // 自动识别:用户输入连字符FC2格式 031926-100 → 转换为下划线格式 031926_100(JAVDB的FC2格式) + // 保持连字符格式去搜索 if (/^\d{5,6}-\d+$/.test(id)) { - id = id.replace('-', '_'); - console.log(chalk.gray(` FC2番号已转换为: ${id}`)); + console.log(chalk.gray(` 识别为FC2番号: ${id}`)); } const cached = getCache(id); diff --git a/package.json b/package.json index d71a378..3f39d77 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "javinfo", - "version": "1.1.6", + "version": "1.1.7", "description": "AV番号命令行查询工具", "main": "./index.js", "type": "module",