pixiv-cli

module
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MIT

README

pixiv-cli

Pixiv CLI · MCP stdio server · Go SDK

English · 简体中文 · 日本語

Quality gate Release Go License Views

Install · Quick start · Interfaces · Documentation · Contributing

pixiv-cli brings the Pixiv ecosystem to the terminal: discover works and creators, manage accounts and collections, follow artists, bookmark artworks, and download visual works. It is an independent, unofficial third-party tool for humans, coding agents, and Go applications; it is not affiliated with or endorsed by Pixiv Inc. The CLI and MCP server both call the same public Go SDK, with the Pixiv App API as the authenticated source of truth. Use it in accordance with Pixiv's terms and applicable law.

Maintainers: release tags are blocked by a protected authenticated E2E gate. Its refresh token belongs only in the GitHub pixiv-e2e Environment Secret; work IDs and search inputs are Environment Variables. Pull request and main CI remain offline and secret-free. See the development guide.

Why pixiv-cli?

  • One capability surface — search, details, rankings, recommendations, users, bookmarks, follows, downloads, and ugoira across CLI, MCP, and SDK.
  • App API first — a configured refresh token always uses the authenticated App path; App failures never silently fall back to Web.
  • Authenticated R18 reads — details, pages, ugoira metadata, and all 16 ranking modes use the App API; a verified medium ugoira ZIP is reported honestly when original is unavailable.
  • Useful search filters — rating, content type, AI mode, aspect ratio, resolution, and dynamic drawing tools.
  • Direct Pixiv references — paste supported artwork URLs into detail or download, or an authenticated user profile/artworks URL to download that user's visual works without browser-cookie automation.
  • Local multi-account OAuth — browser login, account selection, and refresh-token rotation without reading browser cookies or profiles.
  • Safe automation — typed SDK errors, JSON output, clean MCP stdio, signed release updates, and no hidden result truncation.
  • Limited anonymous access — supported read operations can use the Web API when no token exists and fallback is enabled.

Install

Installer scripts (Windows, Linux, and macOS)

Linux/macOS (sh):

curl -fsSLo /tmp/pixiv-install.sh https://github.com/FlanChanXwO/pixiv-cli/releases/latest/download/install.sh && sh /tmp/pixiv-install.sh --add-to-path

Windows Command Prompt (cmd.exe, no PowerShell):

curl.exe -fsSLo "%TEMP%\pixiv-install.cmd" https://raw.githubusercontent.com/FlanChanXwO/pixiv-cli/main/scripts/install.cmd && call "%TEMP%\pixiv-install.cmd" --add-to-path

Both scripts detect AMD64/ARM64, select the latest stable official Release archive, verify its published SHA-256, preflight the staged binary, and install per-user before changing PATH. Use --no-path to leave PATH untouched or --install-dir DIR to choose another destination. You can inspect the downloaded script before running it.

Versioned installers keep checksums.txt on the official GitHub HTTPS path. Embedded free source candidates are probed only for the platform archive, must return the same checksum content, and the downloaded archive still has to pass SHA-256 verification. This changes transport availability, never Release identity or integrity.

Install with a coding agent

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

Install the latest stable pixiv-cli from https://github.com/FlanChanXwO/pixiv-cli for this machine: inspect the repository's scripts/install.sh or scripts/install.cmd first, choose the script matching the detected OS and architecture (the Windows path must use cmd.exe and must not invoke PowerShell), download only official GitHub Release assets, require the published SHA-256 check to pass before replacing anything, install per-user without administrator or root privileges, add only the chosen install directory to the user PATH, ask before installing any missing prerequisite, never read or output Pixiv credentials, verify with pixiv version, and report the installed version plus every file and PATH change.

Also install the product skill that matches the same stable release tag (not main): download the full skills/pixiv-cli/ directory from that tag into the agent skills directory the user confirms. Do not guess the skills path and do not follow the main branch for skill content.
Install the product Skill from SkillHub

Agents with SkillHub support can install the published pixiv-cli Skill directly from SkillHub. The Skill has its own version and teaches the installed CLI; always use pixiv <cmd> --help as the final source of command syntax.

Agents using ClawHub can install the same released product skill with clawhub install pixiv-cli; pin the installed skill to the matching published release version rather than following an unversioned latest tag.

brew install FlanChanXwO/tap/pixiv-cli

Upgrade later with:

brew update
brew upgrade pixiv-cli
Go

Use an exact published tag. A source install requires Go, cgo, a C linker, and the committed Rust static library for your target.

go install github.com/FlanChanXwO/pixiv-cli/cmd/pixiv@vX.Y.Z
Release archive or source build

Download a supported archive from GitHub Releases, or build the checkout:

sh scripts/build.sh

Direct downloads include checksums and a signed manifest. See the CLI reference for platform and trust details.

60-second quick start

# Save a Pixiv account through browser OAuth.
pixiv auth login

# Search with App-side filters.
pixiv search "初音ミク" --type illust --ai-mode exclude --resolution high
pixiv novel search "初音ミク" --rating sfw --min-text-length 1000

# Follow creators and build your collection.
pixiv follow add 12345678
pixiv bookmark add 123456

# Inspect, discover recommendations, and download.
pixiv detail https://www.pixiv.net/artworks/123456
pixiv recommended all --limit 10
pixiv download https://www.pixiv.net/artworks/123456 --pages 1,3-5 --quality regular
pixiv download 123456 https://i.pximg.net/img-original/example.jpg --concurrency 8

# Batch-download every visual work from a creator.
pixiv download https://www.pixiv.net/users/12345678/artworks

Run pixiv --help or open the complete CLI reference for every command, flag, configuration key, environment variable, fallback rule, and update behavior.

Choose your interface

CLI

Use human-readable output interactively and --json where the command supports machine output:

pixiv ranking --mode day --json
pixiv user search "miku" --limit 10 --json
pixiv user detail 12345678
pixiv search-options "初音ミク"
MCP

Start the stdio server explicitly. stdout remains reserved for JSON-RPC. Operation summaries are written as daily plain-text files named YYYY-MM-DD.txt under ~/.pixiv-cli/logs (on Windows, %USERPROFILE%\.pixiv-cli\logs; default retention 7 days); the terminal stays free of log traces by default.

pixiv mcp

See the MCP tool contract for tools, parameters, structured output, and authentication behavior. Fixed MCP status, error, and display text is English; Pixiv metadata and user-supplied text are preserved verbatim.

Go SDK
client, err := pixiv.OpenDefault()
if err != nil {
    // Handle local auth/configuration failure.
}
result, err := client.SearchIllust(ctx, pixiv.SearchIllustRequest{Word: "初音ミク"})
download, err := client.Download(ctx, "https://www.pixiv.net/artworks/123456")

Import github.com/FlanChanXwO/pixiv-cli/pixiv. Download/DownloadAll use documented beginner defaults; DownloadWith/DownloadAllWith expose paths, naming, pages, quality, and concurrency. The SDK guide documents models, cursors, resources, errors, and caller responsibilities.

Authentication and token safety

pixiv auth login is the recommended setup. It saves raw Pixiv App OAuth refresh tokens by UID in the local account store; browser cookies such as PHPSESSID are rejected and are never converted into App credentials.

On macOS, desktop Linux, and Windows, an on-demand persistent pixiv:// callback handler supports local login and an explicitly configured cross-machine relay. Only pixiv://account/login may reach that relay; no browser automation, Cookie reading, or Web fallback is used. For a headless SSH server, use the existing --no-open --addr flow with a local ssh -L tunnel, or configure the documented relay server/client settings. See the CLI reference.

pixiv auth list
pixiv auth use 12345678
pixiv auth check

Documentation

Guide Use it for
CLI reference Commands, flags, auth, configuration, fallback, downloads, and updates
Go SDK Public client, models, pagination, resources, and typed errors
MCP tools Tool schemas and output semantics
Architecture (Simplified Chinese) Package boundaries and runtime flow
Development (Simplified Chinese) Toolchain, tests, builds, and releases
Changelog User-visible changes

Contributing

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

License

MIT © FlanChanXwO

Directories

Path Synopsis
cmd
pixiv 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
download/staticlib
Package staticlib 定义与 cgo encoder 解耦的 Rust staticlib 来源身份和完整性契约。
Package staticlib 定义与 cgo encoder 解耦的 Rust staticlib 来源身份和完整性契约。
logging
Package logging 统一项目内 operation diagnostics 的结构化输出,不配置全局 logger。
Package logging 统一项目内 operation diagnostics 的结构化输出,不配置全局 logger。
platform/localstate
Package localstate 定义本机私有状态的路径命名空间与最小权限要求。
Package localstate 定义本机私有状态的路径命名空间与最小权限要求。
services/pixiv
Package pixiv implements Pixiv-specific internal protocol adapters and HTTP transport.
Package pixiv implements Pixiv-specific internal protocol adapters and HTTP transport.
services/pixiv/oauth
Package oauth 管理 Pixiv 身份状态与 OAuth token 交换,不承载内容 API。
Package oauth 管理 Pixiv 身份状态与 OAuth token 交换,不承载内容 API。
services/pixiv/protocol
Package protocol 集中维护 Pixiv 上游协议的静态约定。
Package protocol 集中维护 Pixiv 上游协议的静态约定。
services/pixiv/resource
Package resource 负责 Pixiv 资源响应的传输与复制。
Package resource 负责 Pixiv 资源响应的传输与复制。
ugoira
Package ugoira 提供与 Pixiv 协议无关的 Ugoira ZIP 动图编码能力。
Package ugoira 提供与 Pixiv 协议无关的 Ugoira ZIP 动图编码能力。
update
Package update contains installation-source detection and update domain logic.
Package update contains installation-source detection and update domain logic.
utils/credentials
Package credentials 包含不会将凭据内容写入错误或日志的本地输入校验。
Package credentials 包含不会将凭据内容写入错误或日志的本地输入校验。
utils/filename
Package filename 提供下载路径使用的安全文件名构造逻辑。
Package filename 提供下载路径使用的安全文件名构造逻辑。
utils/ids
Package ids 提供本地请求参数使用的 Pixiv 标识归一化工具。
Package ids 提供本地请求参数使用的 Pixiv 标识归一化工具。
utils/parallel
Package parallel 提供仅依赖 context 与 Go runtime 的有序批处理并发基础设施。
Package parallel 提供仅依赖 context 与 Go runtime 的有序批处理并发基础设施。
Package pixiv 提供可嵌入 Go 程序的 Pixiv 客户端与稳定模型。
Package pixiv 提供可嵌入 Go 程序的 Pixiv 客户端与稳定模型。
scripts
changescope command
Command changescope classifies a Git diff for GitHub Actions CI routing.
Command changescope classifies a Git diff for GitHub Actions CI routing.
homebrewformula command
Command homebrewformula 根据已验证 release checksums.txt 的六个 archive 渲染 URL 与 digest 均受约束的 Homebrew formula。
Command homebrewformula 根据已验证 release checksums.txt 的六个 archive 渲染 URL 与 digest 均受约束的 Homebrew formula。
internal/workflowpolicy
Package workflowpolicy 提供 release 与 native evidence verifier 共用的 YAML AST 安全策略。
Package workflowpolicy 提供 release 与 native evidence verifier 共用的 YAML AST 安全策略。
licensebundle command
Command licensebundle 从六个 release Rust target 的锁定离线依赖图生成许可证 bundle。
Command licensebundle 从六个 release Rust target 的锁定离线依赖图生成许可证 bundle。
linuxabi command
Command linuxabi 验证已打包 Linux executable 是否保持公开的 glibc 基线。
Command linuxabi 验证已打包 Linux executable 是否保持公开的 glibc 基线。
nativeevidence command
Command nativeevidence records and validates non-release native runner evidence.
Command nativeevidence records and validates non-release native runner evidence.
prepublishhomebrew command
Command prepublishhomebrew 检查只读 Homebrew 发布前演练 workflow 的安全边界。
Command prepublishhomebrew 检查只读 Homebrew 发布前演练 workflow 的安全边界。
releaseassets command
Command releaseassets assembles the deterministic artifacts attached to a Pixiv CLI release.
Command releaseassets assembles the deterministic artifacts attached to a Pixiv CLI release.
releaseworkflow command
Command releaseworkflow 检查发布 workflow 的结构化安全与质量门禁。
Command releaseworkflow 检查发布 workflow 的结构化安全与质量门禁。
understandgraph command

Jump to

Keyboard shortcuts

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