Skip to main content
Glama

bilinote

B 站视频转笔记工具集:把 B 站的字幕、语音转写、搜索、评论、合集等能力, 整理成 AI 编码工具(Claude Code / Codex / ZCode / DSH)可直接挂载的 MCP 工具面, 外加一个久经打磨的 批量字幕/音频命令行工具。

agent(Claude Code / Codex / ZCode / DSH)与人类用户
 │  MCP (stdio)                        │ shell
 ├── bilinote-mcp(15 个工具)──────────┤
 │        │                            ▼
 │        │                    bili-subtitle(批量 CLI)
 │        ▼                            │
 │   batch.py 批量引擎(续跑/熔断/并发/进度回调)
 │        │                            │
 └────────► bili/ 协议层(自维护,Wbi 签名)──► B 站 Web API
  • 协议层自维护:核心端点为自实现(参考 biliAPI / bilibili-API-collect), 不依赖第三方 B 站 SDK;Wbi 签名已内置(搜索/播放器接口已签名)。

  • 单运行时:纯 Python(>=3.10),无 node 工具链。

安装

推荐:从 PyPI 安装(隔离环境,不碰你的 Python 环境)

pipx install bilinote
# 或:uv tool install bilinote

pipx 把 bilinote 及其全部依赖装进独立虚拟环境,只把 bili-subtitle 与 bilinote-mcp 两个命令暴露到 PATH——安装/升级/卸载都不影响你已有的任何 Python 项目。 升级:pipx upgrade bilinote(uv 用户:uv tool upgrade bilinote)。

给 MCP 用的话,可以完全不安装——uvx 直接从 PyPI 拉起服务器,见下一节。

从 git 安装(想跟 main 或使用尚未发布的改动时):

pipx install git+https://github.com/caiqianzhang/bilinote.git@v0.2.0
# 或传统方式(装进当前 Python 环境,与已安装的包共享解释器):
pip install git+https://github.com/caiqianzhang/bilinote.git@v0.2.0

离线 / 内网:从 Releases 下载 bilinote-<版本>-py3-none-any.whl 后 pipx install ./bilinote-0.2.0-py3-none-any.whl。 安装期不需要联网拉构建依赖,适合不可达 PyPI 的机器。

开发者:克隆 + pip install -e .[dev];发版流程(PyPI Trusted Publishing)见 docs/release.md。

要求 Python ≥ 3.10(CI 覆盖 3.10 / 3.12 / 3.14)。安装后获得两个命令: bili-subtitle(批量下载 CLI)与 bilinote-mcp(MCP 服务器)。

Related MCP server: Bilibili API MCP Server

MCP 接入

服务器是 stdio 模式。默认接入方式:uvx 直接运行已发布的包,无需预先安装 (需要本机有 uv:pipx install uv 或 curl -LsSf https://astral.sh/uv/install.sh | sh)。各家注册示例见 docs/setup,速查:

// Claude Code(.mcp.json 或 claude mcp add)/ ZCode 通用 JSON 形态
{ "mcpServers": { "bilinote": { "command": "uvx", "args": ["--from", "bilinote", "bilinote-mcp"] } } }
# Codex CLI(~/.codex/config.toml)
[mcp_servers.bilinote]
command = "uvx"
args = ["--from", "bilinote", "bilinote-mcp"]

已用 pipx install bilinote 装过的话,直接调命令即可(少一次 uvx 解析):

[mcp_servers.bilinote]
command = "bilinote-mcp"

--from bilinote 是必要的:包名是 bilinote,而可执行文件名是 bilinote-mcp, uvx 默认按命令名找同名包,不写 --from 会去找并不存在的 bilinote-mcp 包。

想在配置里锁版本,把包名换成带版本约束的形式即可(升级靠手动改这里):

"args": ["--from", "bilinote==0.2.0", "bilinote-mcp"]

首次 uvx 运行会下载并缓存依赖到 ~/.cache/uv,之后启动直接命中缓存; 若客户端从 GUI 启动、PATH 里找不到 uvx,用 which uvx 的绝对路径填 command。

DeepSeek Harness(DSH):若其支持标准 stdio MCP 客户端,用同一命令即可; 不支持时可用 bili-subtitle CLI 兜底(任何能跑 shell 的 agent 都能用)。

工具清单(15 个)

工具

说明

search_videos

综合搜索(Wbi 已签名,未登录可用)

get_video_info

视频详情 + 分 P 列表

get_video_subtitles

单集字幕正文(CC/AI 轨,含时间戳)

get_video_chapters

视频章节(UP 主分段,笔记骨架)

download_audio

音频轨直连下载(不经 yt-dlp)

asr_transcribe

必剪 ASR 语音转字幕(srt/lrc/txt/json)

list_comments

评论区只读(热门/最新)

list_uploader_videos

UP 主投稿列表

list_uploader_collections / get_collection_videos

合集与合集内视频

list_favorite_folders / list_favorite_videos

收藏夹只读(需登录)

qr_login_start / qr_login_poll

扫码登录(跨调用轮询)

batch_download_subtitles

批量下载(直调引擎:断点续跑、结构化进度)

CLI(批量字幕/音频)

bili-subtitle "https://www.bilibili.com/video/BVxxx" --all-parts --format srt --output notes.srt
bili-subtitle "https://www.bilibili.com/video/BVxxx" --audio --audio-dir out/audio

支持:全部分 P、?p=N/短链解析、断点续跑(已存在跳过)、并发 --jobs + 全局限速 --rate、 连续失败熔断 --fail-fast、浏览器 Cookie 自动读取。音频走 playurl 直连(0.2.0 起不再依赖 yt-dlp)。 详细参数 bili-subtitle -h。

扫码登录(推荐):

bili-subtitle --login    # 终端显示二维码,B 站 App 扫码确认,Cookie 存 cookies.json

MCP 里用 qr_login_start(返回二维码图片内容 + PNG 路径 + ASCII 文本 + 链接, 四层展示任选)+ qr_login_poll 轮询;cookies.json 会被自动发现并加载。

优先级:显式参数 > 环境变量 BILI_COOKIE > cookies.json > 浏览器自动读取 > 匿名。 匿名可用:搜索 / 视频信息 / 部分字幕 / 音频。需登录:高清晰度播放流、收藏夹、 以及多数视频的 CC/AI 字幕(B 站策略)。

安全边界(有意设计):不提供任何读取/导出 Cookie 的工具;全部工具为只读, 唯一的批量写路径是"下载文件到本地"。投稿/点赞/评论发布等账号写操作不在此库范围内。

已知限制(如实记录)

  • 必剪 ASR:全链路可用(实测 7 分钟音频 → 162 段中文识别 → SRT 正确)。 该免费接口有 IP 频控:短时间内反复上传会触发临时 -412(request was banned), 等待数分钟冷却即自行恢复,请勿高频连续调用。

  • UP 主投稿列表:B 站风控较严,出现 -412 时需提供登录 Cookie。

  • 弹幕(protobuf)、直播回放、历史记录在路线图中未实现,见 docs/architecture.md。

测试

python -m pytest tests/ -q --cov=bilinote       # 离线 130 项(128 通过 + 2 跳过)
BILINOTE_LIVE=1 python -m pytest -m live -q     # 真实网络 11 项(搜索/字幕/合集/多P/收藏/入口/MCP 协议)

分层说明:离线测试覆盖 Wbi 签名/客户端重试与缓存、CLI 回归(28 项迁移基准)、 真实响应结构冻结(test_parsing.py)、MCP 工具包装层、ASR 状态机与导出格式、 扫码登录各状态解析;live 测试打 @live 标记,验证链路可用性,断言宽松(内容依赖)。 cli.py 为行为冻结区,不纳入覆盖率统计。

CI 另有一条 package-smoke 任务:构建 sdist/wheel → twine check --strict → 装进干净虚拟环境跑离线测试,确保发布出去的那份 wheel(而不是工作树)是好的。

许可证

MIT © 2026 caiqianzhang。B 站接口协议参考了社区公开文档 (bilibili-API-collect、 renmu123/biliAPI),实现为原创。

仅用于个人学习与效率工具用途,请遵守 B 站用户协议,勿用于批量抓取等滥用场景。

Available Tools

15 tools
asr_transcribeA

必剪 ASR 语音转字幕(无需登录)。audio_path 支持 flac/aac/m4a/mp3/wav; fmt: srt / lrc / txt / json / segments。长音频上传+识别可能需要 1-3 分钟。

Inputs: audio_path (required), fmt.

batch_download_subtitlesA

批量下载字幕(断点续跑,已存在自动跳过)。all_parts=True 下载全部分 P; fmt: text/srt/json;output 为输出文件路径(all_parts 时自动加 .pN 后缀)。 长任务可能耗时数分钟;返回结构化进度事件与结果汇总。

Inputs: url (required), output (required), fmt, limit, +1 more.

download_audioA

直连下载视频的音频轨(m4s,选最低码率省流量)。为 asr_transcribe 备料; 需要完整音频文件时也可用 batch 工具或 bili-subtitle CLI 的 --audio。

Inputs: url_or_bvid (required), p, output_dir.

get_collection_videosB

合集(season_id)或系列(series_id)内的视频列表,二选一。

Inputs: mid (required), page, season_id, series_id.

get_video_chaptersB

视频章节(UP 主手动分段,来自播放器接口)。无章节返回空列表。是笔记的结构骨架。

Inputs: url_or_bvid (required), p.

get_video_infoA

视频详情:标题/简介/UP主/分P列表(含每集 cid 与时长)。支持 BV 号或任意 B 站链接。

Inputs: url_or_bvid (required).

get_video_subtitlesA

取单集字幕正文(B 站已有 CC/AI 字幕时)。返回语言、分段(含时间戳)与全文。 没有字幕轨时报错——此时用 download_audio + asr_transcribe 现场转写。

Inputs: url_or_bvid (required), p, lang.

list_commentsB

视频评论区(只读)。order: hot=热门, time=最新。高赞评论常含勘误与补充,做笔记前值得看。

Inputs: url_or_bvid (required), page, order.

list_favorite_foldersA

当前登录用户创建的收藏夹列表(需登录 Cookie)。

Inputs: no named parameters.

list_favorite_videosB

收藏夹内的视频列表(需登录 Cookie)。配合字幕/ASR 可把收藏夹整体转笔记。

Inputs: folder_id (required), page.

list_uploader_collectionsA

UP 主的合集/系列列表(课程大多以合集组织)。返回 id/name/total,配合 get_collection_videos 用。

Inputs: mid (required).

list_uploader_videosC

UP 主投稿列表。order: pubdate/click/stow。配合批量字幕可把整个 UP 主的课程转笔记。

Inputs: mid (required), page, order.

qr_login_pollA

查询扫码登录状态(waiting=未扫/scanned=已扫未确认/confirmed=成功)。 confirmed 时返回 cookies;提供 cookies_path 则同时保存到文件。

Inputs: qrcode_key (required), cookies_path.

qr_login_startA

开始扫码登录:返回二维码(图片内容 + PNG 路径 + ASCII 文本 + 原始链接)。

把二维码展示给用户,用 B 站 App 扫码并在手机上点确认; 然后用返回的 qrcode_key 调 qr_login_poll 轮询状态,confirmed 即登录成功 (保存的 cookies.json 会被后续需要登录的工具自动使用)。 render: "png"=返回图片内容与 PNG 路径(默认,推荐); "ascii"=仅返回终端文本二维码;"none"=仅返回链接。

Inputs: render.

search_videosC

综合搜索 B 站视频。返回 bvid/标题/UP主(mid)/播放数/时长/简介。

Inputs: keyword (required), page.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 15 tools

    Disambiguation5/5

    Each tool targets a distinct resource/action: search, video info, subtitles, chapters, audio download, ASR, comments, uploader/collection/favorite listing, and QR login. Even the subtitle-related tools are clearly separated by existing vs generated transcripts and single vs batch operations, with explicit cross-references.

    Naming Consistency4/5

    Most tools follow a predictable verb_noun pattern with consistent list_favorite_ and list_uploader_ prefixes. Minor deviations like asr_transcribe and get_collection_videos (instead of list_collection_videos) break the pattern slightly, but the overall style remains readable and navigable.

    Tool Count5/5

    With 15 tools, the server sits at the upper edge of the ideal range, and each tool maps to a concrete step in the video-to-notes workflow. There are no redundant or decorative tools, and the breadth is justified by the many ways Bilibili content can be discovered and collected.

    Completeness5/5

    The tool surface covers the full pipeline: search/discovery, video and chapter metadata, transcript acquisition via existing subtitles or ASR, comment context, batch collection/favorite workflows, and login support. Missing write operations are irrelevant for a read/extract server, so agents have no dead ends.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with Bilibili (哔哩哔哩) through its API, supporting video search and recommendations, user search, dynamic feeds, video collections, and danmaku retrieval through natural language.
      5
      -
    • A
      license
      A
      quality
      B
      maintenance
      Enables agents to search, explore trending content, retrieve video metadata and hot comments, and obtain subtitle transcripts for summarisation on Bilibili, with an anonymous tier and an optional account tier for personalized feeds.
      10
      4
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI clients to query and download Bilibili video data, including metadata, streams, danmaku, subtitles, comments, search, hot lists, users, live rooms, and account read-only items through MCP tools.
      15
      1
      MIT