SkillsGrove
SkillsGrove/영상 제작/TingdeLiu/Tyndall-Skills/video-subtitle-extractor

video-subtitle-extractor

설치

$npx skills add https://github.com/TingdeLiu/Tyndall-Skills --skill video-subtitle-extractor
$git clone --depth 1 https://github.com/TingdeLiu/Tyndall-Skills.git /tmp/Tyndall-Skills && mkdir -p ~/.claude/skills && cp -r /tmp/Tyndall-Skills/video-subtitle-extractor ~/.claude/skills/video-subtitle-extractor
이 Agent Skill을 설치해 주세요: https://github.com/TingdeLiu/Tyndall-Skills/tree/fbd42476f9a282e69c9726b613488e92a39ebe1e/video-subtitle-extractor — 먼저 SKILL.md와 스크립트를 읽고, 안전하다고 확인한 뒤에만 제 skills 폴더에 설치해 주세요.

요약

원문 설명 · MITExtract 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.
아래 SKILL.md는 TingdeLiu/Tyndall-Skills(커밋 fbd4247)에서 MIT 라이선스에 따라 게시한 것입니다. 본문은 변경하지 않았으며, 파일 상단의 메타데이터만 생략하고 이미지는 링크로 표시하며 매우 긴 파일은 일부만 표시합니다. Copyright 2026 Tingde Liu. 라이선스: LICENSE. 지침 파일만 표시되며 스크립트 등은 원본 저장소를 참고하세요.

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.

라이선스 전문 보기(MIT)
MIT License

Copyright (c) 2026 Tingde Liu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.