Skip to main content

Bilibili Subtitle Fetch

一个用于获取 Bilibili 视频字幕的 MCP Server,支持语言和输出格式选项。

uv tool install bilibili-subtitle-fetch

支持以下输入:

  • BV 号,例如 BV1fz4y1j7Mf
  • 标准视频链接,例如 https://www.bilibili.com/video/BV1fz4y1j7Mf?p=2
  • 短链,例如 https://b23.tv/FAm7Xn4

配置

凭据配置文件

首次使用时执行 bilibili-subtitle-fetch init,然后粘贴你的 Bilibili Cookie。

默认配置文件路径:

  • Windows: %APPDATA%\bilibili-subtitle-fetch\config.toml
  • Linux/macOS: ~/.config/bilibili-subtitle-fetch/config.toml

也可以通过 --config /path/to/config.toml 指定自定义路径。

配置文件会在 [credential] 下保存这些字段:

  • sessdata - 访问需要登录态的字幕接口时必需
  • bili_jct - 自动刷新时必需
  • ac_time_value - 自动刷新时必需
  • buvid3、buvid4、dedeuserid - 可选,但建议一并保存

当 sessdata、bili_jct 和 ac_time_value 都存在时,服务会在发起需要登录态的请求前自动检查是否需要刷新 Cookie,并将新值回写到 config.toml,不需要手动执行刷新命令。

ASR 配置 (可选)

配置文件同样支持 [asr] 段落配置默认的音频转写行为:

  • enable_asr - 是否开启 ASR 回退 (true/false)。开启后,如果视频未提供自带字幕,程序会自动下载音频并生成字幕。
  • model_size - Whisper 模型大小,默认为 base。也可以选用 tiny、small 等。

运行参数

  • --preferred-lang - 覆盖默认字幕语言
  • --output-format - 覆盖默认输出格式
  • --config - 使用自定义配置文件路径

CLI 用法

先执行 bilibili-subtitle-fetch init 配置 Cookie,然后可以直接在终端获取字幕:

bilibili-subtitle-fetch fetch BV1fz4y1j7Mf
bilibili-subtitle-fetch fetch "https://www.bilibili.com/video/BV1fz4y1j7Mf?p=2"

可选参数:

  • --copy, -c - 将获取的字幕复制到系统剪贴板(默认不复制)
  • --output-format text|timestamped - 指定输出格式(纯文本或带时间戳格式)
  • --preferred-lang - 指定优先字幕语言(默认 zh-CN)
  • --asr - 强制启用 ASR 语音识别回退(当视频无字幕时本地转写)
  • --no-asr - 强制关闭 ASR 语音识别回退
  • --verbose, -v - 开启详细调试与 HTTP 请求日志
  • --no-clipboard - (向后兼容)不复制到剪贴板

获取 Bilibili 凭据

Metadata

Release files for bilibili-subtitle-fetch 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bilibili-subtitle-fetch 0.3.4
File Size Uploaded Provenance Actions
bilibili_subtitle_fetch-0.3.4.tar.gz 187.7 kB Without provenance Details for bilibili_subtitle_fetch-0.3.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bilibili-subtitle-fetch 0.3.4
File Interpreter ABI Platform Actions
bilibili_subtitle_fetch-0.3.4-py3-none-any.whl Python 3 none any Details for bilibili_subtitle_fetch-0.3.4-py3-none-any.whl

Total release size: 214.2 kB

Release files / bilibili_subtitle_fetch-0.3.4.tar.gz

Download URL bilibili_subtitle_fetch-0.3.4.tar.gz
Size 187.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f5201df73c4fb6c962ac3250ca0bdb740c5524dd9f3d5f5235d0c65014db957d
BLAKE2b-256 checksum
How to use checksums
f7034016192824d2161a5495ae305f02121a0ffdd79e94a4fa5f092c90d3275e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / bilibili_subtitle_fetch-0.3.4-py3-none-any.whl

Download URL bilibili_subtitle_fetch-0.3.4-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cde9bd648565564f73e7812135e62994dcf812cb86b222970eeaa5b1e232e44d
BLAKE2b-256 checksum
How to use checksums
21029cc508320e7effaf3ada60c422e60d92c625980fe75bb1d9946bc0651125
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for bilibili-subtitle-fetch 0.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page