agentleFS
TingdeLiuTingdeLiu/Tyndall-Skills/video-subtitle-extractor/SKILL.md

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

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
  1. Very specific:

    Use video-download instead when the user wants the video file, wants subtitles they can actually watch (.srt / .mkv with bilingual tracks), …

    line 17
  2. Distinctive:

    Run the extraction script with the video URL

    line 24
  3. Distinctive:

    Run from this skill's directory (paths below are relative to the skill root):

    line 29

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. Run the extraction script with the video URL
  2. 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 en

Authentication (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.txt or youtube.com_cookies.txt
  • Bilibili: www.bilibili.com_cookies.txt or bilibili.com_cookies.txt

Note: --cookies-from-browser chrome fails when Chrome is running (database locked). --cookies-from-browser edge fails 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.

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.