bilibili-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

bilibili-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
--yaml
flag for structured output (agent-friendly).
export PATH="$HOME/.local/bin:$PATH"
bili <command> [args]
请始终使用
--yaml
标志以获得结构化输出(便于Agent处理)。

Commands

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 output
bash
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 works
bash
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 10
bash
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 list
bash
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 list
bash
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 user
bash
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 dir
Output:
/tmp/bilibili-cli/{title}/
by default. WAV segments are ASR-ready.
bash
bili audio BV1xxx                              # 下载并分割(25秒片段,WAV 16kHz单声道)
bili audio BV1xxx --segment 60                 # 60秒片段
bili audio BV1xxx --no-split                   # 完整音频(m4a格式)
bili audio BV1xxx -o ~/data/                   # 自定义输出目录
默认输出路径:
/tmp/bilibili-cli/{title}/
。WAV片段适用于ASR(自动语音识别)。

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 credentials
bash
bili login                                     # 二维码登录(交互式,仅支持终端)
bili status                                    # 检查登录状态
bili whoami --yaml                             # 当前用户详情
bili logout                                    # 清除已保存的凭证

Auth

Auth

  • bili login
    generates a QR code in terminal for Bilibili app scan
  • 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
  • bili login
    会在终端生成二维码,供哔哩哔哩APP扫码登录
  • 首次登录后,凭证会保存在本地
  • 浏览/互动类命令需要登录;搜索/视频/热门/排行榜类命令无需登录
  • 登录为交互式(扫码)——仅在SSH CLI中可用,不支持自动化流水线

Output

Output

  • Default: human-readable table/text
  • --json
    : JSON output
  • --yaml
    : YAML output (recommended for agent consumption)
  • Always prefer
    --yaml
    when parsing results programmatically
  • 默认:人类可读的表格/文本
  • --json
    : JSON格式输出
  • --yaml
    : YAML格式输出(推荐Agent使用)
  • 程序化解析结果时,请始终优先使用
    --yaml

Behavior Notes

Behavior Notes

  • BV_OR_URL
    accepts both BV numbers (
    BV1xxx
    ) and full Bilibili URLs
  • UID_OR_NAME
    accepts numeric UID or username string (auto-searches first match)
  • Pagination: most list commands support
    -p/--page
    and
    -n/--max
  • feed
    uses cursor-based pagination (
    --offset
    ), not page numbers
  • audio
    requires
    ffmpeg
    installed for audio extraction and splitting
  • Subtitle availability depends on the video (uploader or AI-generated)
  • --ai
    summary is Bilibili's built-in AI summary, not always available
  • BV_OR_URL
    支持BV号(
    BV1xxx
    )和完整的哔哩哔哩URL
  • UID_OR_NAME
    支持数字UID或用户名(自动匹配第一个结果)
  • 分页:大多数列表类命令支持
    -p/--page
    -n/--max
    参数
  • feed
    使用基于游标的分页(
    --offset
    ),而非页码
  • audio
    命令需要安装
    ffmpeg
    以进行音频提取和分割
  • 字幕可用性取决于视频(由UP主上传或AI生成)
  • --ai
    摘要是哔哩哔哩内置的AI摘要,并非所有视频都提供