bilibili-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesebilibili-cli
bilibili-cli
Bilibili platform CLI — search, browse, interact, and download audio.
哔哩哔哩平台CLI工具——搜索、浏览、互动及下载音频。
Tool
Tool
export PATH="$HOME/.local/bin:$PATH"
bili <command> [args]Always use flag for structured output (agent-friendly).
--yamlexport PATH="$HOME/.local/bin:$PATH"
bili <command> [args]请始终使用标志以获得结构化输出(便于Agent处理)。
--yamlCommands
Commands
Search
Search
bash
bili search "keyword" # Search users (default)
bili search "keyword" --type video # Search videos
bili search "keyword" --type video -n 10 # Limit results
bili search "keyword" --page 2 --yaml # Paginate, YAML outputbash
bili search "keyword" # 搜索用户(默认)
bili search "keyword" --type video # 搜索视频
bili search "keyword" --type video -n 10 # 限制结果数量
bili search "keyword" --page 2 --yaml # 分页,YAML格式输出Video Details
Video Details
bash
bili video BV1xxx --yaml # Basic video info
bili video BV1xxx -s # With subtitles
bili video BV1xxx -st # Subtitles with timeline
bili video BV1xxx --subtitle-format srt # SRT format subtitles
bili video BV1xxx -c # With comments
bili video BV1xxx --ai # With AI summary
bili video BV1xxx -r # With related videos
bili video "https://bilibili.com/video/BV1xxx" # URL also worksbash
bili video BV1xxx --yaml # 基础视频信息
bili video BV1xxx -s # 包含字幕
bili video BV1xxx -st # 带时间轴的字幕
bili video BV1xxx --subtitle-format srt # SRT格式字幕
bili video BV1xxx -c # 包含评论
bili video BV1xxx --ai # 包含AI摘要
bili video BV1xxx -r # 包含相关视频
bili video "https://bilibili.com/video/BV1xxx" # URL同样可用Trending & Rankings
Trending & Rankings
bash
bili hot --yaml # Hot videos (default 20)
bili hot -n 10 -p 2 # Page 2, 10 results
bili rank --yaml # Top ranking (3-day)
bili rank --day 7 -n 10 # 7-day ranking, top 10bash
bili hot --yaml # 热门视频(默认20条)
bili hot -n 10 -p 2 # 第2页,10条结果
bili rank --yaml # 排行榜(3天数据)
bili rank --day 7 -n 10 # 7天排行榜,前10条User / UP主
User / UP主
bash
bili user 12345 --yaml # By UID
bili user "username" --yaml # By name (searches first match)
bili user-videos 12345 -n 20 --yaml # UP's video listbash
bili user 12345 --yaml # 通过UID查询
bili user "username" --yaml # 通过用户名查询(匹配第一个结果)
bili user-videos 12345 -n 20 --yaml # UP主的视频列表Browse (requires login)
Browse (requires login)
bash
bili feed --yaml # Dynamic timeline
bili feed --offset <cursor> # Paginate with cursor
bili favorites --yaml # List all favorites
bili favorites <fav_id> -p 2 --yaml # Videos in a favorite folder
bili history -n 50 --yaml # Watch history
bili watch-later --yaml # Watch later list
bili my-dynamics --yaml # My posted dynamics
bili following --yaml # Following listbash
bili feed --yaml # 动态时间线
bili feed --offset <cursor> # 使用游标分页
bili favorites --yaml # 列出所有收藏
bili favorites <fav_id> -p 2 --yaml # 收藏夹中的视频
bili history -n 50 --yaml # 观看历史
bili watch-later --yaml # 稍后再看列表
bili my-dynamics --yaml # 我发布的动态
bili following --yaml # 关注列表Interact (requires login)
Interact (requires login)
bash
bili like BV1xxx # Like
bili coin BV1xxx # Coin
bili triple BV1xxx # Like + Coin + Favorite
bili dynamic-post "text content" # Post dynamic
bili dynamic-post --from-file ./post.txt # Post from file
bili dynamic-delete <dynamic_id> # Delete dynamic
bili unfollow <uid> # Unfollow userbash
bili like BV1xxx # 点赞
bili coin BV1xxx # 投币
bili triple BV1xxx # 一键三连(点赞+投币+收藏)
bili dynamic-post "text content" # 发布动态
bili dynamic-post --from-file ./post.txt # 从文件发布动态
bili dynamic-delete <dynamic_id> # 删除动态
bili unfollow <uid> # 取消关注用户Audio Download
Audio Download
bash
bili audio BV1xxx # Download + split (25s segments, WAV 16kHz mono)
bili audio BV1xxx --segment 60 # 60s segments
bili audio BV1xxx --no-split # Full audio (m4a)
bili audio BV1xxx -o ~/data/ # Custom output dirOutput: by default. WAV segments are ASR-ready.
/tmp/bilibili-cli/{title}/bash
bili audio BV1xxx # 下载并分割(25秒片段,WAV 16kHz单声道)
bili audio BV1xxx --segment 60 # 60秒片段
bili audio BV1xxx --no-split # 完整音频(m4a格式)
bili audio BV1xxx -o ~/data/ # 自定义输出目录默认输出路径:。WAV片段适用于ASR(自动语音识别)。
/tmp/bilibili-cli/{title}/Account
Account
bash
bili login # QR code login (interactive, terminal only)
bili status # Check login status
bili whoami --yaml # Current user details
bili logout # Clear saved credentialsbash
bili login # 二维码登录(交互式,仅支持终端)
bili status # 检查登录状态
bili whoami --yaml # 当前用户详情
bili logout # 清除已保存的凭证Auth
Auth
- generates a QR code in terminal for Bilibili app scan
bili login - Credentials are saved locally after first login
- Browse/interact commands require login; search/video/hot/rank work without login
- Login is interactive (QR scan) — only works in SSH CLI, not in automated pipelines
- 会在终端生成二维码,供哔哩哔哩APP扫码登录
bili login - 首次登录后,凭证会保存在本地
- 浏览/互动类命令需要登录;搜索/视频/热门/排行榜类命令无需登录
- 登录为交互式(扫码)——仅在SSH CLI中可用,不支持自动化流水线
Output
Output
- Default: human-readable table/text
- : JSON output
--json - : YAML output (recommended for agent consumption)
--yaml - Always prefer when parsing results programmatically
--yaml
- 默认:人类可读的表格/文本
- : JSON格式输出
--json - : YAML格式输出(推荐Agent使用)
--yaml - 程序化解析结果时,请始终优先使用
--yaml
Behavior Notes
Behavior Notes
- accepts both BV numbers (
BV_OR_URL) and full Bilibili URLsBV1xxx - accepts numeric UID or username string (auto-searches first match)
UID_OR_NAME - Pagination: most list commands support and
-p/--page-n/--max - uses cursor-based pagination (
feed), not page numbers--offset - requires
audioinstalled for audio extraction and splittingffmpeg - Subtitle availability depends on the video (uploader or AI-generated)
- summary is Bilibili's built-in AI summary, not always available
--ai
- 支持BV号(
BV_OR_URL)和完整的哔哩哔哩URLBV1xxx - 支持数字UID或用户名(自动匹配第一个结果)
UID_OR_NAME - 分页:大多数列表类命令支持 和
-p/--page参数-n/--max - 使用基于游标的分页(
feed),而非页码--offset - 命令需要安装
audio以进行音频提取和分割ffmpeg - 字幕可用性取决于视频(由UP主上传或AI生成)
- 摘要是哔哩哔哩内置的AI摘要,并非所有视频都提供
--ai