video-subtitle-extractor
Skill8 starsChanged 45 days agoMITView on GitHub
Extract and save subtitles from video URLs as plain .txt files. Supports Bilibili (B站) and YouTube. Use when the user provides a Bilibili or YouTube video link and asks to extract, download, or save subtitles/captions. Triggers on phrases like "提取字幕", "下载字幕", "extract subtitles", "get subtitles", or when a bilibili.com / youtube.com / youtu.be URL is provided with a subtitle-related request. For the video file itself, watchable bilingual subtitles, or proofreading machine-translated captions, use video-download instead.
- Installs packages
In this repository19 other files it gives its agents.
- claude-design-to-open-designSkill
- claude-htmlSkill
- memory-keeperSkill
- obsidian-excalidrawSkill
- paper-insertSkill
- paper-summary-simpleSkill
- paper-summarySkill
- pdf-compressorSkill
- pdf-e2cSkill
- pdf-figure-extractorSkill
- project-summarySkill
- speak-humanSkill
- statusline-buddySkill
- video-downloadSkill
- video-localizeSkill
- vln-feedSkill
- vln-instructionSkill
- vln-paper-insertSkill
- xiaohongshuSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Use video-download instead when the user wants the video file, wants subtitles they can actually watch (.srt / .mkv with bilingual tracks), …
- Distinctive: line 24
Run the extraction script with the video URL
- Distinctive: line 29
Run from this skill's directory (paths below are relative to the skill root):
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Video Subtitle Extractor
Extract subtitles from Bilibili or YouTube videos and save as plain .txt files.
Requires: yt-dlp installed (pip install yt-dlp)
Not this skill
This one produces a plain-text transcript — one language, no timestamps, no video. It does not de-roll rolling auto-captions and does not proofread anything.
Use video-download instead when the user wants the video file, wants subtitles
they can actually watch (.srt / .mkv with bilingual tracks), or wants the machine
translation corrected. Its fetch step covers everything this skill does, so the only
reason to stay here is that a .txt is all that's wanted.
Workflow
- Run the extraction script with the video URL
- Show the user the saved file path and a preview of the content
Script
Run from this skill's directory (paths below are relative to the skill root):
python scripts/extract_subtitles.py <URL> [--output-dir <dir>] [--lang <code>]Arguments:
<URL>— Bilibili or YouTube video URL (required)--output-dir/-o— Where to save the .txt file (default: current directory)--lang/-l— Subtitle language code (optional)--cookies/-c— Path to cookies.txt file (required for login-gated videos)
Default language priority:
- Bilibili:
zh-Hans→ai-zh→zh→zh-CN - YouTube:
zh-Hans→zh→zh-CN→en
Common examples
# Bilibili (auto-detect language)
python scripts/extract_subtitles.py "https://www.bilibili.com/video/BV1xx411c7mD"
# YouTube, save to Downloads
python scripts/extract_subtitles.py "https://youtu.be/dQw4w9WgXcQ" --output-dir "downloads"
# Force English
python scripts/extract_subtitles.py "https://www.youtube.com/watch?v=abc" --lang enAuthentication (cookies)
YouTube and some Bilibili videos require login. Export cookies from your browser using the Get cookies.txt LOCALLY extension, then pass the file:
python scripts/extract_subtitles.py "<URL>" --cookies "path/to/cookies.txt"Or drop it in this skill's cookies/ directory and the script picks it up without --cookies. Only these exact names are recognised — anything else in the folder is ignored:
- YouTube:
www.youtube.com_cookies.txtoryoutube.com_cookies.txt - Bilibili:
www.bilibili.com_cookies.txtorbilibili.com_cookies.txt
Note:
--cookies-from-browser chromefails when Chrome is running (database locked).--cookies-from-browser edgefails on Windows due to DPAPI encryption. Use a cookies.txt file instead.
Cookies expire. When a fetch that used to work starts demanding sign-in, re-export over the same file.
Troubleshooting
No subtitles found — List available languages first:
yt-dlp --list-subs "<URL>"Then re-run with --lang <code> from the list.
HTTP 429 (Too Many Requests) — YouTube rate-limiting. Wait a moment and retry.
Bilibili "subtitles only available when logged in" — Export Bilibili cookies and pass with --cookies.
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
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.

