diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aafcb34 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +.DS_Store +*.log diff --git a/README.md b/README.md new file mode 100644 index 0000000..45f2c02 --- /dev/null +++ b/README.md @@ -0,0 +1,242 @@ +# AvDict 🎬 + +> 一个命令行查询 AV 车牌号详细信息的工具 + +[![npm version](https://img.shields.io/badge/version-1.2.1-blue.svg)](https://github.com/gdjdkid/AvDict) +[![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-green.svg)](https://nodejs.org) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) +[![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20Windows%20%7C%20macOS-lightgrey.svg)]() + +输入一个车牌号,即可获取女优、发售日期、制作商、时长、类别等完整信息。支持多数据源自动兜底,无需手动切换。 + +![示例](https://raw.githubusercontent.com/gdjdkid/AvDict/master/example.gif) + +--- + +## 功能特点 + +- 🔍 **多数据源自动兜底** — 依次查询 JAVBUS → NJAV → JavLibrary → JAVDB,任意一个命中即返回 +- 📋 **信息完整** — 女优、男优、发售日期、时长、制作商、发行商、导演、系列、类别、封面、评分 +- 💾 **本地缓存** — 查询结果缓存 7 天,减少重复请求 +- 🖥️ **跨平台** — 支持 Linux、Windows、macOS +- 🎨 **彩色输出** — 终端美化显示,字段分色,清晰易读 +- ⚡ **查询快速** — 直接番号拼 URL,无需登录即可使用 + +--- + +## 系统要求 + +- Node.js >= 18.0.0 +- npm >= 6.0.0 +- curl(Linux/macOS 系统自带;Windows 请确认 Git Bash 环境下可用) + +--- + +## 支持的平台 + +| 平台 | JAVBUS | NJAV | JavLibrary | JAVDB | +|------|--------|------|------------|-------| +| Linux / macOS | ✅ | ✅ | ✅ | ✅ | +| Windows | ✅ | ✅ | ✅ | ❌ | + +> JAVDB 在 Windows 上因 Cloudflare TLS 指纹限制无法使用,其他三个数据源在 Windows 上完全正常。 + +--- + +## 安装方法 + +**方式一:通过 npm 安装(推荐)** +```bash +npm install -g javdict +``` + +**方式二:从 GitHub 克隆安装(开发者)** +```bash +git clone https://github.com/gdjdkid/AvDict.git +cd AvDict +npm install +npm install -g . +``` + +**验证安装成功:** + +```bash +jav -v +``` + +--- + +## 使用说明 + +**查询车牌号:** + +```bash +jav SSIS-001 +jav ABF-331 +jav JUR-067 +``` + +**输出原始 JSON 数据:** + +```bash +jav -r SSIS-001 +``` + +**清空本地缓存:** + +```bash +jav --clear-cache +``` + +**配置 JAVDB Cookie(可选):** + +```bash +jav --setup +``` + +**显示帮助信息:** + +```bash +jav -h +``` + +--- + +## 命令行选项 + +``` +Usage: jav [options] [番号] + +Arguments: + 番号 要查询的车牌号,例如: SSIS-001 + +Options: + -v, --version 显示版本号 + -r, --raw 以原始 JSON 格式输出结果 + --setup 配置 JAVDB Cookie(可选,提高覆盖率) + --clear-cache 清空本地缓存 + -h, --help 显示帮助信息 +``` + +--- + +## 自定义设置 + +### JAVDB Cookie 配置(可选) + +不配置也可以正常使用,配置后可提高部分冷门番号的查询覆盖率(仅 Linux/macOS 生效)。 + +**获取步骤:** + +1. 用 Chrome 打开 [https://javdb.com](https://javdb.com) 并登录账号 +2. 安装 Chrome 插件 [Get cookies.txt LOCALLY](https://chrome.google.com/webstore/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc) +3. 在 JAVDB 页面点击插件图标,导出 Cookie 文件 +4. 找到 `_jdb_session` 那一行,复制最后一列的值 +5. 运行以下命令并粘贴: + +```bash +jav --setup +``` + +Cookie 配置保存在本地 `~/.config/javinfo/config.json`,不会上传到任何地方。 + +**Cookie 有效期约 2 周**,过期后重新运行 `jav --setup` 更新即可。 + +--- + +## 缓存说明 + +查询结果自动缓存到 `~/.config/javinfo/cache.json`,有效期 7 天。缓存可以: + +- 加快重复查询速度 +- 减少对数据源网站的请求压力 + +如需强制刷新数据,运行: + +```bash +jav --clear-cache +``` + +--- + +## 常见问题 + +**Q: 查询失败提示 `未找到番号`?** + +A: 可能原因有三个: +1. 该番号在所有数据源均未收录(极小众内容) +2. JAVDB Cookie 已过期,运行 `jav --setup` 重新配置 +3. 网络无法访问数据源,请检查代理设置 + +**Q: Windows 上部分番号查不到?** + +A: Windows 上 JAVDB 数据源因 Cloudflare 限制无法使用,少数仅收录于 JAVDB 的番号在 Windows 上无法查询。建议在 Linux 环境(如树莓派)下使用以获得最完整的查询结果。 + +**Q: 提示 `Permission denied`?** + +A: 全局安装时需要管理员权限: +```bash +sudo npm install -g . +``` + +**Q: Cookie 多久需要更新一次?** + +A: 通常 2 周左右,当出现冷门番号突然查不到时,运行 `jav --setup` 更新即可。 + +**Q: 支持 FC2 素人番号吗?** + +A: 支持,输入格式为 `031926-100`(连字符格式),工具会自动识别并转换格式查询。 + +--- + +## 数据来源 + +| 数据源 | 网站 | 特点 | +|--------|------|------| +| JAVBUS | [javbus.com](https://www.javbus.com) | 速度快,数据丰富 | +| NJAV | [njav.com](https://www.njav.com) | 覆盖率高,无需 Cookie | +| JavLibrary | [javlibrary.com](https://www.javlibrary.com) | 数据完整,评分信息 | +| JAVDB | [javdb.com](https://javdb.com) | 数据最全,需要 Cookie | + +--- + +## 开源协议 + +本项目基于 [MIT License](LICENSE) 开源,你可以自由使用、修改和分发。 + +--- + +## 如何贡献代码 + +欢迎提交 PR 或 Issue! + +1. Fork 这个仓库 +2. 创建你的功能分支:`git checkout -b feat/your-feature` +3. 提交改动:`git commit -m "feat: 描述你的改动"` +4. 推送分支:`git push origin feat/your-feature` +5. 提交 Pull Request + +**Commit 规范:** +- `feat:` 新增功能 +- `fix:` 修复 bug +- `docs:` 修改文档 +- `chore:` 杂项维护 + +--- + +## 请作者喝一杯咖啡 ☕ + +如果这个工具对你有帮助,欢迎打赏支持: + +| 微信支付 | 支付宝 | +|---------|--------| +| *(二维码)* | *(二维码)* | + +--- + +## 更新日志 + +- **v1.2.1** — 修复代码细节,稳定性优化 +- **v1.2.0** — 新增 NJAV 第四数据源,调整数据源优先级 +- **v1.1.x** — 三数据源兜底,JAVDB Cookie 改为可选配置,跨平台兼容优化 +- **v1.0.0** — 初始版本发布 diff --git a/README_en.md b/README_en.md new file mode 100644 index 0000000..ec0ae5a --- /dev/null +++ b/README_en.md @@ -0,0 +1,239 @@ +# AvDict 🎬 + +> A command-line tool to look up JAV metadata by title ID — cast, release date, studio, and more + +[![npm version](https://img.shields.io/badge/version-1.2.1-blue.svg)](https://github.com/gdjdkid/AvDict) +[![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-green.svg)](https://nodejs.org) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) +[![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20Windows%20%7C%20macOS-lightgrey.svg)]() + +Type a title ID, get back the full details — cast, release date, studio, duration, tags, and more. Multiple data sources are queried automatically with no manual switching required. + +![Example](https://raw.githubusercontent.com/gdjdkid/AvDict/master/example.gif) + +--- + +## Features + +- 🔍 **Multi-source fallback** — Queries JAVBUS → NJAV → JavLibrary → JAVDB in order; returns on first hit +- 📋 **Rich metadata** — Cast, release date, duration, studio, label, director, series, tags, cover image, rating +- 💾 **Local cache** — Results cached for 7 days to reduce repeat requests +- 🖥️ **Cross-platform** — Linux, Windows, and macOS supported +- 🎨 **Color output** — Terminal-formatted display with field-level color coding +- ⚡ **Fast lookups** — Direct URL construction by title ID; no login required for most sources + +--- + +## Requirements + +- Node.js >= 18.0.0 +- npm >= 6.0.0 +- curl (built into Linux/macOS; ensure it's available in your Git Bash environment on Windows) + +--- + +## Platform Support + +| Platform | JAVBUS | NJAV | JavLibrary | JAVDB | +|----------|--------|------|------------|-------| +| Linux / macOS | ✅ | ✅ | ✅ | ✅ | +| Windows | ✅ | ✅ | ✅ | ❌ | + +> JAVDB is unavailable on Windows due to Cloudflare TLS fingerprint restrictions. The other three sources work fully on Windows. + +--- + +## Installation + +**Option 1: Install via npm (recommended)** +```bash +npm install -g javdict +``` + +**Option 2: Clone from GitHub (for developers)** +```bash +git clone https://github.com/gdjdkid/AvDict.git +cd AvDict +npm install +npm install -g . +``` + +**Verify the installation:** + +```bash +jav -v +``` + +--- + +## Usage + +**Look up a title ID:** + +```bash +jav SSIS-001 +jav ABF-331 +jav JUR-067 +``` + +**Output raw JSON:** + +```bash +jav -r SSIS-001 +``` + +**Clear local cache:** + +```bash +jav --clear-cache +``` + +**Configure JAVDB Cookie (optional):** + +```bash +jav --setup +``` + +**Show help:** + +```bash +jav -h +``` + +--- + +## CLI Options + +``` +Usage: jav [options] [id] + +Arguments: + id Title ID to look up, e.g. SSIS-001 + +Options: + -v, --version Print version number + -r, --raw Output raw JSON instead of formatted display + --setup Configure JAVDB Cookie (optional, improves coverage) + --clear-cache Clear local result cache + -h, --help Show help +``` + +--- + +## Configuration + +### JAVDB Cookie (optional) + +The tool works without any configuration. Adding a JAVDB Cookie improves coverage for niche titles that only exist in JAVDB's database. This only takes effect on Linux/macOS. + +**How to get your Cookie:** + +1. Open [https://javdb.com](https://javdb.com) in Chrome and sign in +2. Install the Chrome extension [Get cookies.txt LOCALLY](https://chrome.google.com/webstore/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc) +3. Click the extension icon on the JAVDB page and export your cookies +4. Find the `_jdb_session` row and copy the value in the last column +5. Run the setup command and paste it in: + +```bash +jav --setup +``` + +Your Cookie is saved locally at `~/.config/javinfo/config.json` and never sent anywhere. + +**Cookies typically expire in about 2 weeks.** When niche titles start returning "not found", just run `jav --setup` again to refresh. + +--- + +## Caching + +Query results are automatically cached to `~/.config/javinfo/cache.json` with a 7-day TTL. This speeds up repeat lookups and reduces load on the source sites. + +To force a fresh fetch: + +```bash +jav --clear-cache +``` + +--- + +## FAQ + +**Q: I get "title not found" — what's wrong?** + +A: There are three likely causes: +1. The title isn't indexed by any of the four sources (extremely niche content) +2. Your JAVDB Cookie has expired — run `jav --setup` to refresh it +3. Your network can't reach the source sites — check your proxy settings + +**Q: Some titles don't show up on Windows?** + +A: JAVDB is unavailable on Windows due to Cloudflare restrictions. A small number of titles that only exist in JAVDB can't be found on Windows. For full coverage, use a Linux environment (e.g. a Raspberry Pi). + +**Q: I get `Permission denied` when installing?** + +A: Global installation requires elevated permissions: +```bash +sudo npm install -g . +``` + +**Q: How often do I need to update my Cookie?** + +A: Roughly every 2 weeks. If niche titles that previously worked start returning "not found", your Cookie has likely expired — run `jav --setup` to update it. + +**Q: Does it support FC2 amateur titles?** + +A: Yes. Enter the title in hyphen format, e.g. `031926-100`. The tool auto-detects FC2 format and handles the conversion internally. + +--- + +## Data Sources + +| Source | Website | Notes | +|--------|---------|-------| +| JAVBUS | [javbus.com](https://www.javbus.com) | Fast, broad coverage | +| NJAV | [njav.com](https://www.njav.com) | High coverage, no Cookie needed | +| JavLibrary | [javlibrary.com](https://www.javlibrary.com) | Detailed metadata, includes ratings | +| JAVDB | [javdb.com](https://javdb.com) | Most comprehensive, requires Cookie | + +--- + +## License + +This project is open source under the [MIT License](LICENSE). You're free to use, modify, and distribute it. + +--- + +## Contributing + +PRs and Issues are welcome! + +1. Fork this repository +2. Create your branch: `git checkout -b feat/your-feature` +3. Commit your changes: `git commit -m "feat: describe your change"` +4. Push the branch: `git push origin feat/your-feature` +5. Open a Pull Request + +**Commit message conventions:** +- `feat:` — new feature +- `fix:` — bug fix +- `docs:` — documentation update +- `chore:` — maintenance / housekeeping + +--- + +## Buy Me a Coffee ☕ + +If this tool saves you time, consider supporting development: + +| WeChat Pay | Alipay | +|------------|--------| +| *(QR code)* | *(QR code)* | + +--- + +## Changelog + +- **v1.2.1** — Minor fixes and stability improvements +- **v1.2.0** — Added NJAV as fourth data source; reordered source priority +- **v1.1.x** — Three-source fallback; JAVDB Cookie made optional; cross-platform compatibility fixes +- **v1.0.0** — Initial release diff --git a/package.json b/package.json index 93e8af2..42c78ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "javinfo", - "version": "1.2.1", + "name": "javdict", + "version": "1.2.2", "description": "AV番号命令行查询工具", "main": "./index.js", "type": "module",