Fix: Add FC2 format search logic
This commit is contained in:
1 parent
56c11e89a3
commit
7649390852
2 files changed
+8
-1
No files matched your search
@@ -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;
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "javinfo",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.4",
|
||||
"description": "AV番号命令行查询工具",
|
||||
"main": "./index.js",
|
||||
"type": "module",
|
||||
|
||||
Reference in new issue
Block a user