| name | bilibili-cli |
| description | CLI skill for Bilibili (哔哩哔哩, B站) with token-efficient YAML output for AI agents to browse videos, users, search, trending, dynamics, favorites, and interactions from the terminal |
| author | jackwener |
| version | 0.6.2 |
| tags | ["bilibili","哔哩哔哩","b站","video","social-media","cli"] |
bilibili-cli Skill
A CLI tool for interacting with Bilibili (哔哩哔哩). Use it to fetch video info, search content, browse user profiles, and perform interactions like liking or triple-clicking.
Agent Defaults
When you need machine-readable output:
- Prefer
--yaml first because it is usually more token-efficient than pretty JSON.
- Use
--json only when downstream tooling strictly requires JSON.
- Keep result sets small with
--max, --page, or --offset.
- Prefer specific commands over broad ones. Example: use
bili user-videos 946974 --max 3 --yaml instead of fetching large timelines.
- When summarizing a video, fetch subtitles first. Subtitles usually contain the video's core content and are the best primary source for summaries.
- Only fall back to
--ai, comments, or audio extraction when subtitles are unavailable or clearly insufficient.
Prerequisites
uv tool install bilibili-cli
uv tool install "bilibili-cli[audio]"
uv tool upgrade bilibili-cli
Authentication
Most read commands work without login. Subtitles, favorites/following/watch-later/history, feed, and interactions require login.
bili status
bili login
Authentication auto-detects local browser cookies (Chrome/Firefox/Edge/Brave). If cookies are found and valid, no manual login needed. Credentials are saved to ~/.bilibili-cli/credential.json.
Command Reference
Video
bili video BV1ABcsztEcY
bili video https://www.bilibili.com/video/BV1ABcsztEcY
bili video BV1ABcsztEcY --subtitle
bili video BV1ABcsztEcY --subtitle-timeline
bili video BV1ABcsztEcY -st --subtitle-format srt
bili video BV1ABcsztEcY --ai
bili video BV1ABcsztEcY --comments
bili video BV1ABcsztEcY --related
bili video BV1ABcsztEcY --yaml
bili video BV1ABcsztEcY --json
User
bili user 946974
bili user "影视飓风"
bili user-videos 946974 --max 20
bili user-videos "影视飓风" --yaml
Search
bili search "关键词"
bili search "关键词" --type video
bili search "关键词" --type video --max 5
bili search "关键词" --page 2
Discovery
bili hot
bili hot --page 2 --max 10
bili rank
bili rank --day 7 --max 30
bili feed
bili feed --offset 1234567890
bili my-dynamics
bili dynamic-post "hello"
bili dynamic-delete 123456789
Collections (require login)
bili favorites
bili favorites <ID> --page 2
bili following
bili watch-later
bili history
Audio Extraction
Requires bilibili-cli[audio] extra (PyAV). Install with uv tool install "bilibili-cli[audio]".
bili audio BV1ABcsztEcY
bili audio BV1ABcsztEcY --segment 60
bili audio BV1ABcsztEcY --no-split
bili audio BV1ABcsztEcY -o ~/data/
Interactions (require login)
bili like BV1ABcsztEcY
bili like BV1ABcsztEcY --undo
bili coin BV1ABcsztEcY
bili coin BV1ABcsztEcY -n 2
bili triple BV1ABcsztEcY
bili unfollow 946974
Account
bili status
bili status --yaml
bili whoami
bili whoami --yaml
bili whoami --json
bili login
bili logout
Structured Output
Major query commands support both --yaml and --json for machine-readable output. Prefer YAML for agent use:
bili status --yaml
bili video BV1ABcsztEcY --yaml
bili hot --max 5 --yaml
bili user 946974 --json | jq -r '.data.user.name'
When stdout is not a TTY, bilibili-cli defaults to YAML automatically.
Use OUTPUT=yaml|json|rich|auto to override the default output mode.
All machine-readable output uses the envelope documented in SCHEMA.md.
Debugging
bili -v <command>
Common Patterns for AI Agents
bili video BV1ABcsztEcY --subtitle
bili video BV1ABcsztEcY --ai
bili video BV1ABcsztEcY --comments
bili audio BV1ABcsztEcY --segment 25
bili user-videos 946974 --max 1 --yaml
bili status && bili like BV1ABcsztEcY
bili search "topic" --type video --max 3 --yaml
Workflow: Video Content Analysis
bili search "AI" --type video --max 5
bili video BV1xxx --subtitle
bili video BV1xxx --ai
bili audio BV1xxx --segment 25
bili video BV1xxx --comments
Workflow: UP主 Research
bili user "影视飓风"
bili user-videos 946974 --max 10
bili video BV1xxx --ai --comments
Error Handling
- Commands exit with code 0 on success, non-zero on failure
- Error messages are prefixed with ❌
- Login-required commands show ⚠️ with instruction to run
bili login
- Invalid BV IDs show a clear error message
Safety Notes
- Do not ask users to share raw credential/cookie values in chat logs.
- Prefer local browser cookie extraction over manual secret copy/paste.
- If auth fails, ask the user to re-login via
bili login.