javdb-cli

module
v0.8.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2026 License: MIT

README

javdb-cli

JavDB CLI · Public Go SDK · Agent skill

English · 简体中文

Quality gate Release Go License Views

Install · Quick start · Interfaces · Documentation · Contributing

javdb-cli is an independent, unofficial command-line client and Go SDK for the JavDB App JSON API. It gives people, coding agents, and Go applications one consistent capability surface for search, catalog navigation, movie details, review pages, selected thumbnail/preview asset writes, magnets, rankings, and authenticated user lists. It is not a website scraper, does not include MCP, and is not affiliated with, endorsed by, or related to JavDB or its operators. Use it only in accordance with JavDB's terms and the laws that apply to you.

Why javdb-cli?

  • CLI and public Go SDK — the CLI and importable javdb package cover search, detail, review pages, selected thumbnail/preview asset writes, tags, browsing, entity filmographies, magnets, rankings, TOP250, collections, authenticated watch/want data, and reverse image search with strict number linking (javdb search IMAGE, javdb cache reverse-search).
  • Integrated magnet search — javdb search KEYWORD --magnets N combines movie search, filtering, ranking, and magnet retrieval; text output emits magnet URIs and --ndjson emits pipeline envelopes.
  • Composable pipelines — most commands accept non-TTY stdin batches; TTY stdout defaults to human-readable text, non-TTY to stable record streams; explicit --ndjson emits javdb.pipeline/v1 envelopes so command output can feed the next command (javdb search --ndjson | javdb detail); --json keeps legacy aggregate shapes where applicable, while fan-out list and collection results use stable id/ref fields and raw data.list/data.entity values. Every fan-out record requires a non-empty stable ID; missing IDs fail explicitly, while a missing display name falls back to the ID in ref. The lists/collections fan-out NDJSON shape is an intentional v1 machine-contract migration. Legacy human output and explicit aggregate --json retain their existing output shapes; list/entity records without a stable ID fail explicitly.
  • API client, not a scraper — commands use the App JSON API with explicit host and proxy selection; failures remain visible rather than becoming fabricated empty results.
  • Useful agent navigation — JSON output, stable graph IDs from detail, and an included operator skill support safe, multi-step automation.
  • Local multi-account credentials — username/password/token data stays in ~/.javdb-cli/auth.json with mode 0600 on POSIX platforms; normal command output never prints the JWT.
  • Deliberate state changes — watch/want marks, default-account changes, configuration writes, and tag-cache refreshes are explicit CLI operations.
  • Native release evidence — macOS, Linux, and Windows on amd64 and arm64 are built, packaged, extracted, and smoke-tested by CI.

Install

brew install FlanChanXwO/tap/javdb-cli

Upgrade later with:

brew update
brew upgrade javdb-cli

The Formula is updated after a verified release when tap deployment is enabled.

Go

Go 1.27.3 is the supported toolchain version for source builds and go install.

Use an exact published tag:

go install github.com/FlanChanXwO/javdb-cli/cmd/javdb@v0.2.0
Release archive or source build

Download the archive for your platform from GitHub Releases, verify it against the accompanying checksums.txt, and place javdb (javdb.exe on Windows) in a directory on your PATH.

To build the checkout, install Go 1.27.3 as declared in go.mod and run:

sh scripts/build.sh
./build/javdb --version

The release contract covers macOS, Linux, and Windows on amd64 and arm64. See the development guide for reproducible target builds and archive contents.

Docker (GHCR and Docker Hub)

Every stable release also publishes the same multi-architecture image (linux/amd64 and linux/arm64) to the GitHub Container Registry and Docker Hub. The image runs as a non-root user and keeps local state under /home/javdb/.javdb-cli (created with private 0700 permissions); mount a named volume there to persist login and cache between runs. The default /work directory is writable by javdb, so relative download output paths work without additional bind mounts.

docker run --rm ghcr.io/flanchanxwo/javdb-cli:v0.2.0 --version

# 挂载命名卷持久化登录状态与缓存;容器内默认工作目录是 /work。
docker run --rm -v javdb-cli-state:/home/javdb/.javdb-cli \
  ghcr.io/flanchanxwo/javdb-cli:latest auth login
docker run --rm -v javdb-cli-state:/home/javdb/.javdb-cli \
  ghcr.io/flanchanxwo/javdb-cli:latest search ABC-123 --limit 5

Docker Hub images are published for stable releases created after that channel is enabled. For those releases, use flanchanxwo/javdb-cli with the same tag.

Both registries publish latest for the newest stable release, exact version tags (vX.Y.Z), and per-architecture tags (vX.Y.Z-linux-amd64, vX.Y.Z-linux-arm64).

Update

Published installations can check for a newer release and install it with:

javdb update --check
javdb update

update detects whether javdb is managed by Homebrew, go install, or a Release archive, then uses that matching channel. Archive updates fetch only the current OS/architecture asset, verify its SHA-256 against the same Release's checksums.txt, validate the downloaded binary's version, and then replace the executable. --check --json is the machine-readable, no-write form; --prerelease includes prerelease tags. A Homebrew installation supports stable releases only. The existing --proxy URL setting also applies to Release checks; update resolves that proxy independently and ignores JavDB host settings.

Install with a coding agent

Copy this prompt into Codex, Claude Code, Cursor, or another local coding agent with terminal access:

Install the latest stable javdb-cli from https://github.com/FlanChanXwO/javdb-cli for this machine. Detect the operating system and architecture, download only official GitHub Release assets, require the matching published SHA-256 from checksums.txt before installing, ask before creating or changing any PATH directory, never read or output ~/.javdb-cli/auth.json or credentials, verify with javdb --version, and report the installed version plus every changed file.

Also install the complete skills/javdb-cli/ directory from the same stable release tag into the agent skills directory that I confirm. Do not guess that skills path, do not use the main branch for the skill, and preserve all reference files.

60-second quick start

# Sign in interactively; the CLI never prints the JWT.
javdb auth login
javdb auth check --json

# Find a movie and inspect graph IDs for the next navigation step.
javdb search ABC-123 --limit 5 --json
javdb detail ABC-123 --json
javdb comments ABC-123 --page 1 --limit 20 --json

# Browse a tag and request a filtered magnet list (works without login).
javdb browse --tag 巨乳 --main m --limit 20 --json
javdb magnets ABC-123 --cnsub --hd --json

# Discover movie media assets, then download exactly what you need.
javdb assets list ABC-123 --type image 1-4 | javdb assets download -d ./images
javdb assets list ABC-123 --type video | javdb assets download -o ./preview.mp4

Run javdb --help or read the complete command reference for all commands, flags, configuration keys, and authentication requirements.

Movie-number targeting is safe and format-tolerant: surrounding whitespace is trimmed, matching is case-insensitive, and one unique formatting-equivalent number may be accepted. Ambiguous or fuzzy-only results fail instead of selecting the first fuzzy result. Use --id only for a confirmed internal movie ID.

Choose your interface

CLI

Use tabular output interactively and --json when a command exposes it and an agent or script needs stable fields:

javdb rankings movies --type fc2 --period week
javdb rankings movies --period week --json
javdb actor 山手梨愛 --main m --has-magnets --json
javdb lists search 巨乳 --zone all --json

Movie and playback rankings accept censored, uncensored, western, or fc2 as their zone selector; ranking periods use day, week, or month.

search --zone and lists search --zone accept the same five zone names and reject invalid values before making a network request. For integrated magnet search, --min-size is non-negative; zero is valid, including when a unit suffix is used.

The global --proxy URL and --host auto|mirror|main|URL flags affect only that command. The default auto host reuses the cached route immediately when validation succeeds. Only a failed cache validation discovers the startup candidates, selects the fastest App API host, and rewrites ~/.javdb-cli/route.json; a fixed host skips route discovery entirely. Use javdb config get before relying on persisted settings.

Go SDK
package main

import (
	"context"
	"fmt"

	"github.com/FlanChanXwO/javdb-cli/sdk"
)

func main() {
	c, err := javdb.New(javdb.WithHost(javdb.HostMirror))
	if err != nil {
		panic(err)
	}

	res, err := c.Search(context.Background(), "ABC-123", javdb.SearchOptions{Limit: 5})
	if err != nil {
		panic(err)
	}
	fmt.Println(len(res.Movies()))
}

Import github.com/FlanChanXwO/javdb-cli/sdk; it declares package javdb, so examples continue to use javdb. The SDK guide documents public models, client options, and caller responsibilities.

Agent skill

The repository ships skills/javdb-cli, a dedicated operator skill for coding agents. It defines credential handling, confirmation boundaries, command-scoped flags, JSON/error handling, and search-to-detail navigation. Load it only for explicit JavDB work, and verify each command's flags with javdb <command> --help.

Install the javdb-cli Skill from ClawHub

Agents using ClawHub can install the published javdb-cli Skill with clawhub install javdb-cli; pin the installed skill to the matching published release version, currently 0.8.5, rather than following an unversioned latest tag.

Authentication and credential safety

javdb auth login is the recommended setup. It keeps the username, password, and session token in the local multi-account store ~/.javdb-cli/auth.json (mode 0600 where POSIX permissions exist). Do not commit, print, paste, or upload that file, passwords, or JWTs.

javdb auth list
javdb auth use USER_ID
javdb auth check --json

javdb auth check verifies the default token without printing it. Token expiry is surfaced clearly by default. auto_relogin is opt-in and uses the saved password for one re-login attempt; enable it only when you accept that behavior:

javdb config set auto_relogin true

All business commands reuse the saved default account. Public queries support anonymous access when the upstream route allows it; authentication failures tell you to run javdb auth login. The opt-in auto_relogin setting applies consistently to normal and piped commands. auth check checks the current token with the server. See the authentication contract.

Diagnostics use stderr; select JSON with --log-format json or adjust verbosity with --log-level debug|info|warning|error. Help and prompts follow the system language (English or Simplified Chinese), separately from the API's lang setting. TOP250 and personal-list commands require a signed-in default account. mark/unmark, account changes, and config set/unset modify server or local state and should be used deliberately. javdb assets download writes selected media assets to explicit new local paths and outputs only the final path per line. MP4 supports one H.264 track and at most one mono/stereo AAC-LC track; see the media contract for validation boundaries. javdb assets list performs best-effort streaming metadata probes after filtering and selectors. JSON/NDJSON always expose type and url, adding available image width/height and preview-video duration (integer seconds); TTY adds compact SIZE/DURATION columns. Pipe output remains strictly TYPE<TAB>URL for assets download. Probing is enabled by default and uses a bounded worker pool; inspect or disable it with javdb config get/set assets.probe.enabled and assets.probe.concurrency (default 4). A failed individual probe only omits metadata, including a media request that times out on its own; cancelling or expiring the parent context still fails the call. They never download a full movie or magnet target and never replace an existing file.

Documentation

Guide Use it for
CLI reference Commands, flags, authentication, configuration, and common workflows
Agent operator skill Safe agent routing, secrets, writes, discovery, and errors
Go SDK Public client, models, and options
Architecture (Simplified Chinese) Package boundaries and runtime flow
Development (Simplified Chinese) Toolchain, tests, platform builds, packaging, and releases
Documentation map Localized public contracts and maintainer guides
Contributing Local quality gates and contribution rules
Changelog Versioned bilingual release notes

Contributing

Bug reports, documentation fixes, tests, and focused features are welcome. Read CONTRIBUTING.md before opening a pull request; discuss large or compatibility-sensitive changes first.

Thank you to everyone who helps improve javdb-cli.

View all contributors

License

MIT © FlanChanXwO

Official JavDB App

Directories

Path Synopsis
cmd
javdb command
internal
buildinfo
Package buildinfo exposes metadata embedded by the Go linker at build time.
Package buildinfo exposes metadata embedded by the Go linker at build time.
cli
Package cli assembles the Cobra root command and implements the CLI entrypoint.
Package cli assembles the Cobra root command and implements the CLI entrypoint.
cli/actor
Package actor 提供实体影片列表命令。
Package actor 提供实体影片列表命令。
cli/assets
Package assets 提供 javdb assets 命令域:影片媒体资产(图片/预览视频)的发现与下载。
Package assets 提供 javdb assets 命令域:影片媒体资产(图片/预览视频)的发现与下载。
cli/auth
Package auth 提供真实的 auth 命令组与交互式凭据输入。
Package auth 提供真实的 auth 命令组与交互式凭据输入。
cli/browse
Package browse 提供按内容标签/年份/月份浏览影片命令。
Package browse 提供按内容标签/年份/月份浏览影片命令。
cli/cache
Package cache 提供本机反搜缓存的运维命令。
Package cache 提供本机反搜缓存的运维命令。
cli/code
Package code 提供实体影片列表命令。
Package code 提供实体影片列表命令。
cli/collections
Package collections 提供用户收藏列表命令。
Package collections 提供用户收藏列表命令。
cli/comments
Package comments 提供影片评论单页命令。
Package comments 提供影片评论单页命令。
cli/detail
Package detail 提供影片详情与可选磁力输出命令。
Package detail 提供影片详情与可选磁力输出命令。
cli/director
Package director 提供实体影片列表命令。
Package director 提供实体影片列表命令。
cli/list
Package list 提供实体影片列表命令。
Package list 提供实体影片列表命令。
cli/lists
Package lists 提供我的合集与公开合集命令组。
Package lists 提供我的合集与公开合集命令组。
cli/magnets
Package magnets 提供影片磁力列表与最佳磁力选择命令。
Package magnets 提供影片磁力列表与最佳磁力选择命令。
cli/maker
Package maker 提供实体影片列表命令。
Package maker 提供实体影片列表命令。
cli/mark
Package mark 提供影片标记命令。
Package mark 提供影片标记命令。
cli/rankings
Package rankings 提供影片/演员/播放排行命令组。
Package rankings 提供影片/演员/播放排行命令组。
cli/recent
Package recent 提供最近浏览影片列表命令。
Package recent 提供最近浏览影片列表命令。
cli/search
Package search 提供影片/实体搜索命令与以图搜番图片模式。
Package search 提供影片/实体搜索命令与以图搜番图片模式。
cli/series
Package series 提供实体影片列表命令。
Package series 提供实体影片列表命令。
cli/tags
Package tags 提供内容标签 taxonomy 命令。
Package tags 提供内容标签 taxonomy 命令。
cli/top250
Package top250 提供 TOP250 排行命令。
Package top250 提供 TOP250 排行命令。
cli/unmark
Package unmark 提供影片取消标记命令。
Package unmark 提供影片取消标记命令。
cli/want
Package want 提供想看影片列表命令。
Package want 提供想看影片列表命令。
cli/watched
Package watched 提供已看影片列表命令。
Package watched 提供已看影片列表命令。
command
Package command 提供六个实体命令的共享管道化实现。
Package command 提供六个实体命令的共享管道化实现。
common/jsonx
Package jsonx 提供纯 JSON 编解码 helper。
Package jsonx 提供纯 JSON 编解码 helper。
common/proxyutil
Package proxyutil 构造支持 CLI 全部既有代理 scheme 的标准库 HTTP transport:http/https 与 socks5/socks5h 由 net/http 原生支持,socks4 与 socks4a 由本包实现拨号握手。
Package proxyutil 构造支持 CLI 全部既有代理 scheme 的标准库 HTTP transport:http/https 与 socks5/socks5h 由 net/http 原生支持,socks4 与 socks4a 由本包实现拨号握手。
common/scalar
Package scalar 提供跨领域复用的基础标量转换。
Package scalar 提供跨领域复用的基础标量转换。
config/paths
Package paths 管理 javdb-cli 本机状态文件的路径。
Package paths 管理 javdb-cli 本机状态文件的路径。
config/settings
Package settings 管理 config.toml 的 schema 与优先级解析。
Package settings 管理 config.toml 的 schema 与优先级解析。
display
Package display 提供 CLI 纯结果投影与过滤,按领域分文件(movie.go、magnet.go、named.go)。
Package display 提供 CLI 纯结果投影与过滤,按领域分文件(movie.go、magnet.go、named.go)。
environment
Package environment owns CLI streams and terminal state.
Package environment owns CLI streams and terminal state.
i18n
Package i18n loads the embedded English and Simplified Chinese CLI catalogs.
Package i18n loads the embedded English and Simplified Chinese CLI catalogs.
javdb/appapi
Package appapi 是签名 App API 的真实 Client 组合层。
Package appapi 是签名 App API 的真实 Client 组合层。
javdb/appapi/client
Package client 持有签名 App API 的 HTTP transport 与公共请求处理。
Package client 持有签名 App API 的 HTTP transport 与公共请求处理。
javdb/appapi/codec
Package codec 负责 App API 的 JSON、JWT、用户 ID 和响应数组解析。
Package codec 负责 App API 的 JSON、JWT、用户 ID 和响应数组解析。
javdb/appapi/endpoint/auth
Package auth 负责登录、启动信息和用户身份解析 endpoint。
Package auth 负责登录、启动信息和用户身份解析 endpoint。
javdb/appapi/endpoint/route
Package route 实现 JavDB App /startup 动态 API 域名的解密、候选提取与线路选择。
Package route 实现 JavDB App /startup 动态 API 域名的解密、候选提取与线路选择。
javdb/appapi/model
Package model 定义 JavDB App API 的稳定配置、响应和领域类型。
Package model 定义 JavDB App API 的稳定配置、响应和领域类型。
javdb/protocol/httpx
Package httpx wraps bogdanfinn/tls-client for Chrome-like TLS fingerprints.
Package httpx wraps bogdanfinn/tls-client for Chrome-like TLS fingerprints.
javdb/protocol/signature
Package signature implements the JavDB app jdsignature header.
Package signature implements the JavDB app jdsignature header.
logging
Package logging owns stderr diagnostics independently of command result streams.
Package logging owns stderr diagnostics independently of command result streams.
record
Package record 实现 javdb.pipeline/v1 机器协议核心:typed envelope、 严格 NDJSON/文本解码、输入分类与输出模式。
Package record 实现 javdb.pipeline/v1 机器协议核心:typed envelope、 严格 NDJSON/文本解码、输入分类与输出模式。
releaseversion
Package releaseversion 统一拥有仓库级稳定发布版本 identity。
Package releaseversion 统一拥有仓库级稳定发布版本 identity。
reversesearch/cache
Package cache 实现反搜响应的文件缓存:key 为 source + 原图 SHA-256, 只保存规范化响应与写入时间(不保存图片、鉴权 header 或 JavDB 详情), 原子写入 0600,TTL 默认 30 天。
Package cache 实现反搜响应的文件缓存:key 为 source + 原图 SHA-256, 只保存规范化响应与写入时间(不保存图片、鉴权 header 或 JavDB 详情), 原子写入 0600,TTL 默认 30 天。
reversesearch/image
Package image 提供反搜图片的统一原始读取入口:本地路径、HTTP(S) URL 与 stdin 流。
Package image 提供反搜图片的统一原始读取入口:本地路径、HTTP(S) URL 与 stdin 流。
reversesearch/provider
Package provider 实现反搜 provider:内置 AVScan adapter 与声明式外部 HTTP adapter。
Package provider 实现反搜 provider:内置 AVScan adapter 与声明式外部 HTTP adapter。
session
Package session 统一配置解析、SDK client 创建与 required/optional 认证生命周期。
Package session 统一配置解析、SDK client 创建与 required/optional 认证生命周期。
session/authstore
Package authstore 只负责默认认证文件的路径、目录与 store 打开。
Package authstore 只负责默认认证文件的路径、目录与 store 打开。
storage/auth
Package auth 持久化 ~/.javdb-cli/auth.json 中的多账户认证资料。
Package auth 持久化 ~/.javdb-cli/auth.json 中的多账户认证资料。
storage/route
Package route 管理自动选线路由缓存(~/.javdb-cli/route.json)的原子读写。
Package route 管理自动选线路由缓存(~/.javdb-cli/route.json)的原子读写。
storage/tags
Package tags 持久化和解析 JavDB tag taxonomy cache。
Package tags 持久化和解析 JavDB tag taxonomy cache。
target
Package target 只保留六类实体命令共享的查询用例。
Package target 只保留六类实体命令共享的查询用例。
update/archive
Package archive verifies and installs platform release archives.
Package archive verifies and installs platform release archives.
update/manifest
Package manifest 定义 v1 签名发布清单协议:发布清单、签名文件、规范 JSON 编码、Ed25519 签名与验签,以及客户端内置的公钥环。
Package manifest 定义 v1 签名发布清单协议:发布清单、签名文件、规范 JSON 编码、Ed25519 签名与验签,以及客户端内置的公钥环。
update/model
Package model 保存更新流程跨领域共享的数据模型。
Package model 保存更新流程跨领域共享的数据模型。
update/process
Package process 管理更新流程中的命令执行、候选二进制校验和平台替换。
Package process 管理更新流程中的命令执行、候选二进制校验和平台替换。
update/release
Package release reads and compares published GitHub releases.
Package release reads and compares published GitHub releases.
update/source
Package source identifies the installation source before an update writes.
Package source identifies the installation source before an update writes.
scripts
internal/releasenotes/audit
Package audit 负责读取 GitHub 元数据并生成发布区间的来源审计报告。
Package audit 负责读取 GitHub 元数据并生成发布区间的来源审计报告。
internal/releasenotes/document
Package document 负责双语 release-note 文档、来源链接和 Release 正文校验。
Package document 负责双语 release-note 文档、来源链接和 Release 正文校验。
internal/releasenotes/github
Package github 封装 release-note 流程使用的 GitHub REST 读写边界。
Package github 封装 release-note 流程使用的 GitHub REST 读写边界。
internal/releasenotes/history
Package history 负责显式同步历史 GitHub Release 正文。
Package history 负责显式同步历史 GitHub Release 正文。
internal/releasenotes/model
Package model 保存 release-note 流程跨领域传递的稳定数据模型。
Package model 保存 release-note 流程跨领域传递的稳定数据模型。
releasenotes command
Command releasenotes audits and validates the versioned changelog contract.
Command releasenotes audits and validates the versioned changelog contract.
sign-release command
Command sign-release 从受保护环境私钥生成并签名 v1 发布清单。
Command sign-release 从受保护环境私钥生成并签名 v1 发布清单。
Package javdb is the public Go SDK for the JavDB app JSON API.
Package javdb is the public Go SDK for the JavDB app JSON API.
tools
internal/verificationpolicy
Package verificationpolicy parses and validates PR-declared verification commands without invoking a shell.
Package verificationpolicy parses and validates PR-declared verification commands without invoking a shell.
platformmatrix command
Command platformmatrix validates the shared CI platform registry and emits GitHub Actions matrix JSON for one capability.
Command platformmatrix validates the shared CI platform registry and emits GitHub Actions matrix JSON for one capability.
prmeta command
Command prmeta validates the pull request template and optional verification block using the trusted repository policy.
Command prmeta validates the pull request template and optional verification block using the trusted repository policy.
release command
Command release provides small release-material operations shared by CI.
Command release provides small release-material operations shared by CI.
verification command
Command verification executes trusted, pre-validated PR verification pipelines and renders sanitized cross-platform results.
Command verification executes trusted, pre-validated PR verification pipelines and renders sanitized cross-platform results.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL