agentleFS
ChenShegChenSheg/knowledge-from-literature-and-bilibili/bilibili-transcript/SKILL.md

bilibili-transcript

Skill1 starsChanged 5 months agoMITView on GitHub

Extract and transcribe text from Bilibili videos. Three paths auto-chain: (1) official/AI CC subtitle via WBI-signed player API (zero deps); (2) official AI transcript via x/web-interface/view/conclusion/get (needs SESSDATA, returns full speech-to-text with timestamps, no model download); (3) fallback downloads audio with yt-dlp and transcribes with faster-whisper for videos with no subtitle at all. Accepts BV id or video URL. Exports TXT + timed SRT. Use when: getting a transcript of a Bilibili video, extracting subtitles/text for notes, summarizing a video, or converting spoken content to searchable text.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. moonmoonCL/bilibili-transcript★ 4same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository3 other files it gives its agents.

The file

Files
SKILL.md

Bilibili Transcript (B站视频文本提取与解析)

从 B站视频提取文字稿。三条路径自动衔接(命中即止):

  1. 官方/AI CC 字幕(零依赖):用 B站 WBI 签名的播放器 API 直接抓取上传字幕或 AI 字幕,秒级完成。
  2. 官方 AI 文稿(需 SESSDATA):调用 x/web-interface/view/conclusion/get,返回 B站自带的 AI 语音转写全文(带时间戳)。无需下载任何模型,最稳。
  3. 语音转写兜底:以上均无结果时,用 yt-dlp 下载音频 + faster-whisper 本地转写。

快速使用

# BV 号或完整链接均可(字幕/AI文稿优先)
python scripts/bili_transcript.py BV1oPFDzQEG7 --out ./bili
python scripts/bili_transcript.py "https://www.bilibili.com/video/BV1oPFDzQEG7" --out ./bili

# 强烈建议带登录 Cookie:解锁 conclusion/get 的官方 AI 全文转写(很多视频无 CC 字幕)
python scripts/bili_transcript.py BV1... --sessdata "你的SESSDATA值"

# 无字幕/无AI文稿时,用 whisper 兜底并指定模型
python scripts/bili_transcript.py BV1... --whisper-model large-v3

# 只要字幕/AI文稿、不要 whisper 兜底
python scripts/bili_transcript.py BV1... --no-fallback

参数:

  • video:BV 号 或 B站视频 URL
  • --out:输出目录(默认 ./bili)
  • --sessdata:登录 Cookie 中的 SESSDATA 值,强烈建议提供——解锁 conclusion/get 官方 AI 全文转写
  • --whisper-model:兜底转写模型 tiny/base/small/medium/large-v3(默认 medium)
  • --no-fallback:无字幕/AI文稿时不调用 whisper,直接退出

输出

<BV>_<标题>.txt(纯文本)+ <BV>_<标题>.srt(带时间轴),保存到 --out。

依赖说明

路径依赖说明
CC 字幕无(Python 标准库)开箱即用;WBI 签名已内置
conclusion/get AI 文稿无(仅需 SESSDATA Cookie)首选,官方 AI 转写全文,零模型下载
whisper 兜底yt-dlp + faster-whisper + av(PyAV)pip install yt-dlp faster-whisper;用 PyAV 解码,不需 ffmpeg.exe

whisper 首次运行会自动下载模型(small≈460MB / medium≈1.5GB / large-v3≈3GB)到缓存,建议后台运行并设较大超时。

本机实测提示(关键):

  • 播放器字幕接口 x/player/wbi/v2 在带登录态时会返回 412(比匿名更严的风控),故 CC 字幕路径在本机不可靠。
  • 正确做法:传 --sessdata 走 conclusion/get 官方 AI 文稿接口,可一次性拿到全文转写(含时间戳),无需任何模型下载。本视频 BV1kKNg62EgT 实测拿到 468 段、约 7200 字全文。
  • 若 conclusion/get 也拿不到(如无语音内容),再走 whisper 兜底。whisper 靠 av(PyAV) 解码音频,不依赖 ffmpeg.exe(运行环境约定见 ENV.md)。

获取 SESSDATA(强烈建议)

浏览器登录 B站 → F12 开发者工具 → Application/存储 → Cookies → 复制 SESSDATA 的值传给 --sessdata。注意保密,勿分享。

提示

  • 知识区/中英混说视频若无官方字幕,优先用 --sessdata 触发 conclusion/get 官方 AI 转写;英文药名等专有名词可能有识别误差,可再用 whisper 交叉核对。
  • 也可用 BBDown --audio-only 替代 yt-dlp 下载音频(.NET 工具,dotnet tool install --global BBDown)。
  • 仅限个人学习研究用途,公开发布或商用需获授权。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.