← Back to Skills Marketplace
scottliu007

Bilibili Subtitles

by fanzhuo · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
236
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install bilibili-subtitles
Description
使用 yt-dlp 从哔哩哔哩公开视频提取已有字幕或自动字幕(不下载整段视频)。当用户提到 B 站、bilibili、BV 号、视频字幕、拉字幕、做摘要、根据视频内容回答问题时使用。v1 仅支持平台已提供字幕轨道的视频;无字幕视频需换源或后续用 Whisper 等方案。
README (SKILL.md)

B 站字幕提取(yt-dlp)

依赖

  • 已安装 yt-dlp(推荐):brew install yt-dlp
  • 保持较新版本:brew upgrade yt-dlp(B 站接口常变)

何时用本 Skill

场景 是否适合 v1
视频有 UP 上传字幕或 B 站自动字幕
无任何字幕轨 ❌(需换有字幕视频,或另做音频转写)

标准流程

1. 查看有哪些字幕

yt-dlp --list-subs "https://www.bilibili.com/video/BVxxxxxxxxxx/"

记下语言代码(如 zh-Hanszh-CN)。

2. 只下载字幕(不下载视频)

yt-dlp --write-subs --write-auto-subs --skip-download \
  --sub-langs "zh-Hans,zh-CN,zh,zh-Hant,en" \
  -o "bilibili_%(id)s.%(ext)s" \
  "https://www.bilibili.com/video/BVxxxxxxxxxx/"
  • --write-auto-subs:含 B 站自动生成的字幕(若有)。
  • 输出多为 .vtt.srt,与视频同目录或当前目录。

3. 把 VTT 收成纯文本(便于喂给模型)

# 简单去时间轴与标记(按需调整路径)
sed -e '/^WEBVTT/d' -e '/^NOTE/d' -e '/^[0-9][0-9]:/d' -e '/^$/d' -e 's/\x3C[^>]*>//g' \
  "某文件.zh-Hans.vtt" | sed '/^$/d' > bilibili_subtitles_plain.txt

若出现 HTTP 412 / 无法下载网页

B 站可能对匿名请求限流。按顺序尝试:

  1. 用浏览器 Cookie(推荐)

    yt-dlp --cookies-from-browser chrome --list-subs "URL"
    

    可将 chrome 换成 safarifirefox(本机需已登录 bilibili.com)。

  2. 导出 Netscape 格式 cookies.txt,再:
    yt-dlp --cookies /path/to/cookies.txt ...

  3. 升级 yt-dlp 后重试。

详见 reference.md

对 Agent 的提示

  • --list-subs,无可用语言则明确告知用户「该 BV 无字幕轨」,不要假装已提取。
  • 提取成功后,优先读 .srt/.vtt 再总结;长文本可先落盘再分段阅读。
  • 勿在回复中粘贴完整 Cookie 或账号秘密。

ClawHub / OpenClaw 发布说明

本 Skill 为 纯文档 + 系统命令,无额外二进制。发布时在描述中写明:依赖 yt-dlp、可能需 Cookie、v1 不做无字幕转写。

Usage Guidance
This skill is coherent and low-risk: it simply documents yt-dlp usage and includes a small helper script. Before installing or running it: ensure yt-dlp is installed from its official source, avoid pasting cookies or secrets into chat, prefer using an exported cookies.txt (or run commands locally) rather than giving long-lived browser session tokens to third parties, and run the script in an environment where accessing your browser cookie store is acceptable. If you need autonomous agents to run it, be aware they could execute yt-dlp commands and potentially access any cookie file you give them — limit the cookie file's scope and lifetime.
Capability Analysis
Type: OpenClaw Skill Name: bilibili-subtitles Version: 1.0.0 The skill facilitates Bilibili subtitle extraction using yt-dlp and includes a shell script (scripts/fetch-subs.sh) for automation. While the functionality is consistent with its stated purpose, the instructions in SKILL.md explicitly guide the AI agent to use high-risk features such as '--cookies-from-browser', which allows access to sensitive local session data. Although the documentation includes a safeguard against leaking these secrets in responses, the capability to access browser data and execute shell commands for file processing (sed) and network requests represents a significant attack surface if the agent is misdirected.
Capability Assessment
Purpose & Capability
Name/description say 'extract Bilibili subtitles with yt-dlp' and all files/instructions align with that. No unrelated services, credentials, or binaries are requested.
Instruction Scope
Runtime instructions and the script only run yt-dlp, list/download subtitle tracks, and post-process VTT to plain text. They do suggest using browser cookies or an exported cookies.txt to bypass B 站 rate-limits — this is expected for the use case but means the agent/command will access local browser cookies if used. The SKILL.md explicitly warns not to paste cookies into replies.
Install Mechanism
Instruction-only skill with no install spec. The only dependency is yt-dlp (user-installed). No downloads from suspicious URLs or archive extraction are present.
Credentials
No environment variables or primary credentials are requested. Optional use of browser cookies or cookies.txt is proportional to the stated need to access rate-limited or logged-in Bilibili pages.
Persistence & Privilege
always is false and the skill does not request persistent system privileges or modify other skills. Model invocation is enabled (normal for skills) but this is not combined with broad credential access.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install bilibili-subtitles
  3. After installation, invoke the skill by name or use /bilibili-subtitles
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial: extract B站已有/自动字幕 via yt-dlp; 412/Cookie 排错见 reference.md; v1 无无字幕转写
Metadata
Slug bilibili-subtitles
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Bilibili Subtitles?

使用 yt-dlp 从哔哩哔哩公开视频提取已有字幕或自动字幕(不下载整段视频)。当用户提到 B 站、bilibili、BV 号、视频字幕、拉字幕、做摘要、根据视频内容回答问题时使用。v1 仅支持平台已提供字幕轨道的视频;无字幕视频需换源或后续用 Whisper 等方案。 It is an AI Agent Skill for Claude Code / OpenClaw, with 236 downloads so far.

How do I install Bilibili Subtitles?

Run "/install bilibili-subtitles" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Bilibili Subtitles free?

Yes, Bilibili Subtitles is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Bilibili Subtitles support?

Bilibili Subtitles is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Bilibili Subtitles?

It is built and maintained by fanzhuo (@scottliu007); the current version is v1.0.0.

💬 Comments