Fix: When comparing, hyphens and underscores are treated as the same character.
This commit is contained in:
1 parent
d7671e38d8
commit
188fa55efc
2 files changed
+6
-5
No files matched your search
+5
-4
@@ -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);
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "javinfo",
|
||||
"version": "1.1.6",
|
||||
"version": "1.1.7",
|
||||
"description": "AV番号命令行查询工具",
|
||||
"main": "./index.js",
|
||||
"type": "module",
|
||||
|
||||
Reference in new issue
Block a user