返回 Skill 列表
extension
分类: 内容与媒体无需 API Key

transcribing-youtube

下载并转录YouTube视频为干净、去重的Markdown文档,并带有章节标题。使用yt-dlp获取字幕(手动或自动生成),移除自动字幕中的滚动文本三重化伪影,从视频元数据中插入章节标记,并生成带时间戳的转录本和纯文本版本。当用户想要:(1) 转录YouTube视频,(2) 从YouTube获取转录本或字幕,(3) 从视频创建InfoNugget,(4) 从YouTube URL或视频ID中提取文本,或者(5) 提到yt-dlp、YouTube转录本或视频字幕时使用。

person作者: jakexiaohubgithub

Transcribing YouTube Videos

Generate clean, deduplicated Markdown transcripts from YouTube videos using yt-dlp.

Prerequisites

Verify CLI dependencies before running:

command -v yt-dlp jq awk sed find

Required: yt-dlp, jq, awk, sed, find (standard POSIX utilities).

Workflow

Step 1: Get the video identifier

Accept any of these input formats:

  • Full URL: https://www.youtube.com/watch?v=q6pbQ5li5Cg
  • Short URL: https://youtu.be/q6pbQ5li5Cg
  • Shorts URL: https://www.youtube.com/shorts/q6pbQ5li5Cg
  • Bare video ID: q6pbQ5li5Cg

Step 2: Run the script

bash {baseDir}/scripts/genInfoNugget.sh <URL_or_VIDEO_ID>

To reprocess an existing SRT without re-downloading:

bash {baseDir}/scripts/genInfoNugget.sh --fix <URL_or_VIDEO_ID>

Step 3: Verify output

The script produces two files in the current directory:

| File | Contents | |------|----------| | *.InfoNug.DDMMMYY.HHMMSS.md | Timestamped transcript with #### chapter headings | | *.InfoNug.DDMMMYY.HHMMSS.md_chapters.md | Prose-only version grouped by chapter (no timestamps) |

After the script completes, read the first ~30 lines of the prose file (_chapters.md) to confirm no triplication. Each phrase should appear exactly once.

Step 4: Present results

Report the two output filenames to the user. If the user wants a summary, read the prose file and summarize by chapter.

How the script works

  1. Download: Tries manual subs first (--write-subs), falls back to auto-generated (--write-auto-subs) only if needed
  2. Deduplicate: AWK pass removes ≤100ms transition blocks and strips rolling duplicate lines carried forward from previous blocks
  3. Chapters: Extracts chapter timestamps from info.json via jq, inserts #### headings in a single AWK pass
  4. Prose: Strips all timestamps and joins text into flowing paragraphs grouped by chapter

Troubleshooting

| Symptom | Cause | Fix | |---------|-------|-----| | "No SRT file found" | No subtitles in target language | Check video has captions enabled | | Tripled text in output | Using old v1 script | Use this skill's script which includes deduplication | | --fix fails with no SRT | Previous run cleaned up intermediate files | Run without --fix to re-download |

Why does tripling happen? See references/faqs.md for a detailed explanation of YouTube's rolling VTT format and how the dedup works.