A CLI for Bilibili — browse videos, users, favorites from the terminal 📺
$ npx -y skills add jackwener/bilibili-cli --agent claude-code
What's inside
A CLI for Bilibili — browse videos, users, favorites from the terminal 📺
English | 中文
--yaml and --jsonOUTPUT=yaml|json|rich|autook/schema_version/data/error# Recommended: uv tool (fast, isolated)
uv tool install bilibili-cli
# Or: pipx
pipx install bilibili-cli
# If you need audio extraction support
uv tool install "bilibili-cli[audio]"
# or
pipx install "bilibili-cli[audio]"
Upgrade to the latest version:
uv tool upgrade bilibili-cli
# Or: pipx upgrade bilibili-cli
Tip: Upgrade regularly to avoid unexpected errors from outdated API handling.
Or from source:
git clone git@github.com:jackwener/bilibili-cli.git
cd bilibili-cli
uv sync
Run tests in the project environment:
uv sync --extra dev
uv run pytest -q
uv run ruff check .
uv run python -m mypy bili_cli
If the project directory was moved and stale virtualenv wrappers remain, rerun:
uv sync --extra dev --reinstall
# Login & account
bili status # Check login status
bili status --yaml # Structured auth status
bili login # QR code login
bili whoami # Detailed profile (level, coins, followers)
bili whoami --yaml # Structured profile
# Videos
bili video BV1ABcsztEcY # Video details
bili video BV1ABcsztEcY --subtitle # With subtitles (plain text)
bili video BV1ABcsztEcY --subtitle-timeline # With timeline
bili video BV1ABcsztEcY -st --subtitle-format srt # Export as SRT
bili video BV1ABcsztEcY --ai # AI summary
bili video BV1ABcsztEcY --comments # Top comments
bili video BV1ABcsztEcY --related # Related videos
bili video BV1ABcsztEcY --yaml # Agent-friendly YAML
bili video BV1ABcsztEcY --json # Normalized JSON envelope
bili video BV1ABcsztEcY --subtitle-timeline --comments --json # Extras in one payload
# Users
bili user 946974 # UP profile
bili user "影视飓风" # Search by name
bili user-videos 946974 --max 20 # Video list
# Discovery
bili hot # Trending videos (page 1)
bili hot --page 2 --max 10 # Page 2, top 10
bili rank # Site-wide ranking (3-day)
bili rank --day 7 --max 30 # 7-day ranking, top 30
bili search "关键词" # Search users
bili search "关键词" --type video --max 5 # Search videos (top 5)
bili search "关键词" --page 2 # Next page
bili feed # Dynamic timeline
bili feed --offset 1234567890 # Next page via returned cursor
bili my-dynamics # My posted dynamics
bili dynamic-post "抽个奖,明天开奖" # Publish text dynamic
bili dynamic-delete 123456789012345678 # Delete one dynamic
# Collections
bili favorites # Favorite folders
bili favorites <ID> --page 2 # Videos in a folder
bili following # Following list
bili watch-later # Watch later
bili history # Watch history
# Audio extraction
bili audio BV1ABcsztEcY # Download + split into 25s WAV segments
bili audio BV1ABcsztEcY --segment 60 # 60s per segment
bili audio BV1ABcsztEcY --no-split # Full m4a, no splitting
bili audio BV1ABcsztEcY -o ~/data/ # Custom output directory
# Interactions
bili like BV1ABcsztEcY # Like
bili coin BV1ABcsztEcY # Give coin
bili triple BV1ABcsztEcY # 一键三连 🎉
bili unfollow 946974 # Unfollow by UID
bili like BV1ABcsztEcY --json # Structured write result
bili coin BV1ABcsztEcY --yaml # Structured write result
bilibili-cli uses a 3-tier authentication strategy:
~/.bilibili-cli/credential.jsonbili login displays a QR code in the terminalCredentials are validated on use for authenticated commands. Expired cookies are automatically cleared, while transient network validation failures keep local credentials for best-effort fallback.
bili status exits with code 0 only when authenticated; otherwise it exits with 1.
Most commands work without login. Subtitles, favorites/following/watch-later/history, feed, my-dynamics, and interactions require authentication. Write actions (like/coin/triple/unfollow/dynamic-post/dynamic-delete) require write-capable credential (bili_jct).
Audio extraction requires the optional audio dependency group (av).
All --json / --yaml output uses the shared envelope from SCHEMA.md.
Major commands now emit normalized payloads instead of raw upstream SDK blobs:
bili video → data.video, data.subtitle, data.ai_summary, data.comments, data.related, data.warningsbili hot / bili rank → data.itemsbili search → normalized user/video listsbili like / bili coin / bili triple / bili unfollow → normalized write-action resultsStructured errors now use more specific codes such as not_authenticated, permission_denied, invalid_input, network_error, upstream_error, and not_found.
bilibili-cli ships with a SKILL.md that teaches AI agents how to use it.
If an AI agent needs machine-readable output, prefer --yaml first:
--yaml is usually more token-efficient than pretty-printed JSON--json for jq, strict JSON-only tooling, or exact downstream schemasOUTPUT=yaml|json|rich|auto to override the default modeExamples:
bili status --yaml
bili video BV1ABcsztEcY --yaml
bili hot --max 5 --yaml
bili user-videos 946974 --max 3 --yaml
For agent usage, also prefer narrower queries (--max, --page, --offset) to avoid wasting context on oversized payloads.
When an AI agent is asked to summarize a video, it should fetch subtitles first. Subtitles usually contain the core content of the video and are the best primary source for summarization. Only fall back to AI summary, comments, or audio extraction when subtitles are unavailable or insufficient.
npx skills add jackwener/bilibili-cli
| Flag | Description |
|---|---|
-g | Install globally (user-level, shared across projects) |
-a claude-code | Target a specific agent |
-y | Non-interactive mode |
mkdir -p .agents/skills
git clone git@github.com:jackwener/bilibili-cli.git .agents/skills/bilibili-cli
Once added, AI agents that support the .agents/skills/ convention will automatically discover and use bilibili-cli commands.
⚠️ ClawHub install method is deprecated and no longer supported. Use Skills CLI or Manual Install above.
需要登录 / not_authenticated — Run bili login to scan QR code, or ensure you're logged in to bilibili.com in Chrome/Firefox/Edge/Brave.HTTP 412 / RateLimitError — Bilibili anti-scraping triggered. Wait a moment and retry, or reduce --max.无法提取 BV 号 / InvalidBvidError — Check the BV ID or URL format. Must be BV followed by 10 alphanumeric characters.NetworkError — Check your network connection. If behind a proxy, ensure it supports the target domain.当前登录凭证不支持写操作 — Your saved cookies lack bili_jct. Run bili login to re-authorize with full write permission.Structured error codes: not_authenticated, permission_denied, invalid_input, network_error, upstream_error, not_found, rate_limited, internal_error.
--yaml 和 --jsonOUTPUT=yaml|json|rich|auto 覆盖# 推荐:uv tool(快速、隔离环境)
uv tool install bilibili-cli
# 或者:pipx
pipx install bilibili-cli
# 如果需要音频提取功能
uv tool install "bilibili-cli[audio]"
# 或
pipx install "bilibili-cli[audio]"
升级到最新版本:
uv tool upgrade bilibili-cli
# 或:pipx upgrade bilibili-cli
提示: 建议定期升级,避免因版本过旧导致的 API 调用异常。
或从源码安装:
git clone git@github.com:jackwener/bilibili-cli.git
cd bilibili-cli
uv sync
开发环境验证:
uv sync --extra dev
uv run pytest -q
uv run ruff check .
uv run python -m mypy bili_cli
如果项目目录发生过移动,导致旧的 virtualenv wrapper 失效,可重新执行:
uv sync --extra dev --reinstall
Convert any website into a CLI & run Browser Use on your logged-in Chrome. Turn websites, browser sessions, Electron apps, and local tools into deterministic interfaces for humans and AI agents.
FAQ
bilibili-cli is a Claude Code plugin with 1 hand-picked skill for content work, indexed on Flowy. Install it with the command on its page. It includes bilibili-cli. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.
Is this plugin yours?
Claim it with GitHubSubmit a pluginPromote it