本地提取 YouTube 字幕,精准导航每一秒
简介
本地提取 YouTube 字幕,保留时间戳与章节导航,支持多格式导出,无需付费 API 或代理服务
原始描述
Fetch, summarize, and save YouTube transcripts with timestamp navigation, chapter detection, and searchable content.
通过你的 Agent 添加
安装目录:youtube-video-transcript/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心用法
YouTube Video Transcript 是一款基于 yt-dlp 的本地字幕提取工具,用户只需提供视频链接即可获取结构化文本稿。核心流程包括:首先通过 yt-dlp -j 获取视频元数据(标题、时长、官方章节、可用语言),优先尝试提取人工上传的高质量字幕,若无则降级使用自动生成字幕。所有文本均保留 [HH:MM:SS] 格式时间戳,支持章节自动检测(包括视频标记提取与语义断点智能识别)和关键词搜索定位,可一键生成带时间戳跳转链接的引用片段。
显著优点
- 完全本地运行:依赖开源工具
yt-dlp,无需调用付费 API 或第三方代理,避免隐私泄露风险 - 结构化输出:自动识别视频章节,支持 Markdown/SRT/TXT/JSON 多格式导出,便于笔记整理与视频编辑
- 精准导航:时间戳贯穿全流程,支持"跳转到讨论 X 的时刻"类语义查询,返回带上下文(前后 10-15 秒)的结果
- 质量分级透明:明确区分人工字幕与自动生成字幕,主动提示后者可能存在错误
- 隐私可控:本地缓存需用户明确授权,可随时查看或删除,符合 GDPR 友好原则
潜在局限
- 字幕可用性依赖:若视频上传者关闭字幕或 YouTube 未生成自动字幕,则无法提取
- 自动生成质量参差:无人工校对时,专业术语、口音较重的内容识别准确率有限
- 仅支持 YouTube:不兼容其他视频平台(Bilibili、Vimeo 等需另寻方案)
- 无实时翻译能力:需配合其他翻译工具使用,本体仅提取原始语言文本
适合人群
- 研究人员:需要引用视频内容并标注精确时间戳
- 内容创作者:整理采访素材、提取金句制作短视频
- 学习者:偏好阅读而非观看,需快速检索课程要点
- 无障碍需求用户:将视频内容转换为可搜索的文本档案
常规风险
| 风险类型 | 说明 | 缓解措施 |
|---|---|---|
| 版权合规 | 提取受版权保护内容可能违反平台 ToS | 仅用于个人学习研究,避免批量下载商用 |
| 数据残留 | 本地缓存文件若未清理可能泄露观看历史 | 定期清理 ~/youtube-video-transcript/videos/ 目录 |
| 工具依赖 | yt-dlp 更新滞后可能导致提取失败 |
保持 yt-dlp 版本同步更新 |
| 误信自动字幕 | 关键引用若基于错误识别可能导致学术不严谨 | 重要内容务必人工核对原视频 |
技能正文
name: YouTube Video Transcript slug: youtube-video-transcript version: 1.0.0 homepage: https://clawic.com/skills/youtube-video-transcript description: Fetch, summarize, and save YouTube transcripts with timestamp navigation, chapter detection, and searchable content. changelog: Initial release with transcript extraction, timestamp navigation, chapter detection, and multi-format export. metadata: {"clawdbot":{"emoji":"📺","requires":{"bins":["yt-dlp"]},"install":[{"id":"brew","kind":"brew","formula":"yt-dlp","bins":["yt-dlp"],"label":"Install yt-dlp (Homebrew)"},{"id":"pip","kind":"pip","package":"yt-dlp","bins":["yt-dlp"],"label":"Install yt-dlp (pip)"}],"os":["linux","darwin","win32"]}}
Most YouTube transcript tools either require paid APIs, use suspicious proxies, or just dump raw text without structure. This skill extracts transcripts locally using yt-dlp, preserves timestamps for navigation, detects chapters automatically, and exports to any format you need.
When to Use
User shares a YouTube link and wants to read instead of watch. User asks what someone says about a topic at a specific moment. User needs to extract quotes with timestamps for research or content creation. User wants to summarize a video or search within its content.
How It Works
┌──────────────────────────────────────────────┐
│ YOUTUBE TRANSCRIPT FLOW │
└──────────────────────────────────────────────┘
│
┌────────────────────┼────────────────────┐
▼ ▼ ▼
┌─────────┐ ┌──────────┐ ┌─────────┐
│ VIDEO │ │ METADATA │ │SUBTITLES│
│ URL │ │ FETCH │ │ CHECK │
└────┬────┘ └────┬─────┘ └────┬────┘
│ │ │
│ youtube.com/ │ Title, duration, │ Manual first,
│ watch?v=... │ chapters, lang │ auto fallback
│ │ │
└───────────────────┴────────────────────┘
│
▼
┌─────────────────┐
│ EXTRACT + CLEAN │
│ VTT → Markdown │
│ with timestamps │
└────────┬────────┘
│
┌───────────────┼───────────────┐
▼ ▼ ▼
┌──────────┐ ┌───────────┐ ┌──────────┐
│ CHAPTERS │ │ SEARCH │ │ EXPORT │
│ detected │ │ by topic │ │ MD/SRT/ │
│ or smart │ │ timestamp │ │ TXT/JSON │
└──────────┘ └───────────┘ └──────────┘
The Extraction Process
1. 📋 Get Metadata First
Always fetch video info before extracting subtitles:
yt-dlp -j "VIDEO_URL"
This gives you title, duration, official chapters, and available languages. Use it to confirm the right video and check what subtitles exist.
2. 📝 Prefer Manual Subtitles
Manual (uploaded) subtitles are higher quality than auto-generated:
# Try manual first
yt-dlp --write-sub --sub-lang en --skip-download "VIDEO_URL"
# Fall back to auto-generated if manual unavailable
yt-dlp --write-auto-sub --sub-lang en --skip-download "VIDEO_URL"
Auto-generated transcripts often have errors, missing punctuation, and wrong word boundaries. Manual subtitles are human-verified.
3. 🕐 Preserve Timestamps Always
Every segment must include timestamps. Format: [HH:MM:SS] or [MM:SS] for videos under 1 hour.
Why this matters: Users need to jump to specific moments. "Take me to where they discuss pricing" requires knowing the timestamp.
Output format:
[00:00] Welcome to this video about machine learning
[00:15] Today we'll cover three main topics
[00:30] First, let's talk about neural networks
Chapter Detection
From Video Markers
Many videos have chapter markers embedded. Extract from metadata:
yt-dlp -j "VIDEO_URL" | jq '.chapters'
Smart Detection (No Markers)
When video lacks chapters, detect natural breaks from transcript:
- Topic changes (semantic shift in content)
- Speaker changes (different voice patterns)
- Explicit transitions ("Now let's talk about...", "Moving on...")
- Long pauses between segments
Search Within Transcripts
When user asks "where do they talk about X":
- Search transcript for keywords and semantic matches
- Return segments with timestamps
- Include surrounding context (10-15 seconds before/after)
Response format:
Found 3 mentions of "machine learning":
[05:23] "...this is where machine learning really shines..."
Context: Discussing data processing approaches
[12:45] "...traditional methods vs machine learning..."
Context: Comparison section
Generate clickable links: https://youtube.com/watch?v=VIDEO_ID&t=323
Architecture
Memory lives in ~/youtube-video-transcript/. See memory-template.md for structure.
~/youtube-video-transcript/
├── memory.md # Preferences + recent videos
├── videos/ # Cached transcripts (with consent)
│ └── {video_id}.md # Individual video data
└── exports/ # Exported files
Quick Reference
| Topic | File |
|---|---|
| Setup process | setup.md |
| Memory template | memory-template.md |
| Advanced patterns | patterns.md |
Core Rules
1. Metadata Before Extraction
Always run yt-dlp -j URL first. This confirms the video, shows available languages, and reveals official chapters. Never extract blind.
2. Manual Over Auto
| Subtitle Type | Quality | When to Use |
|---|---|---|
| Manual | High | Always try first |
| Auto-generated | Medium | Fallback only |
Check with yt-dlp --list-subs URL for unfamiliar channels.
3. Timestamps Are Sacred
Never strip timestamps during any operation. They enable navigation, citation, and deep linking into the video.
4. Cache With Consent
| User Response | Action |
|---|---|
| "Yes, save it" | Cache to ~/youtube-video-transcript/videos/ |
| "No thanks" | Don't cache, show once |
| Not asked yet | Ask after first extraction |
Always tell user where files are saved and offer to show or delete them.
5. Handle Multiple Languages
If user doesn't specify:
- Check available languages
- Prefer manual over auto
- Default to English
- Report which language was used
yt-dlp --list-subs "VIDEO_URL"
6. Quote Extraction Includes Context
When extracting quotes for research:
- 10-15 seconds before/after for context
- Exact timestamp for the quote start
- Speaker identification if multiple speakers
7. Transparency on Quality
| Subtitle Type | Tell User |
|---|---|
| Manual | "Using official subtitles" |
| Auto-generated | "Using auto-generated (may have errors)" |
| None available | "No subtitles found for this video" |
Export Formats
| Format | Use Case | Command |
|---|---|---|
| Markdown | Reading, notes | Default |
| SRT | Video editors | --sub-format srt |
| Plain text | Search, grep | Strip timestamps |
| JSON | Programmatic | --write-info-json |
Common Traps
| Trap | Consequence | Prevention |
|---|---|---|
| Not checking subtitles first | Wasted time on unavailable video | Always --list-subs first |
| Ignoring auto-generated quality | Garbage text with errors | Prefer manual, warn about auto |
| Losing timestamps | Can't navigate video | Never strip in any operation |
| Extracting without metadata | Missing title, chapters | Always fetch -j first |
| Caching without consent | Privacy violation | Ask before saving |
Quick Commands
| User Says | Action |
|---|---|
| "Transcribe this video" | Extract + display |
| "What do they say about X?" | Search + timestamps |
| "Save this transcript" | Cache with confirmation |
| "Export as SRT" | Convert format |
| "Show saved videos" | List ~/youtube-video-transcript/videos/ |
| "Delete video X" | Remove from cache |
Security & Privacy
Data that stays local (with your consent):
- Transcripts cached in ~/youtube-video-transcript/ (only if you agree)
- Preferences stored locally (only after confirmation)
- No external API calls beyond YouTube's public subtitle endpoints
Transparency guarantees:
- Always asks before saving transcripts locally
- Tells you where files are saved
- Offers to show or delete saved data anytime
This skill does NOT:
- Use proxy services or third-party APIs
- Send your queries to external services
- Store credentials or authentication
- Save anything without your explicit consent
Related Skills
Install with clawhub install <slug> if user confirms:
summarizer— create summaries from any contentvideo-captions— generate and edit video subtitlesffmpeg— advanced video and audio processing
Feedback
- If useful:
clawhub star youtube-video-transcript - Stay updated:
clawhub sync
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。