YouTube Transcript Generator
Download clean transcripts from any YouTube video URL.
Requirements
- -
yt-dlp must be installed (brew install yt-dlp or pip install yt-dlp)
Usage
Run the bundled script with a YouTube URL:
CODEBLOCK0
The script will:
- 1. Try to download English manual subtitles first
- Fall back to auto-generated English subtitles
- Try all available languages if English is unavailable
- Clean the raw subtitle file into readable paragraphs
- Output the transcript to stdout and save to INLINECODE3
Options
CODEBLOCK1
How It Works
- 1.
yt-dlp downloads the subtitle track (VTT/SRT format) - The script strips HTML tags and duplicate lines
- Without timestamps (default): merges into clean, readable paragraphs
- With timestamps: preserves
[HH:MM:SS] markers before each line for easy reference
Example Output
Input: INLINECODE6
Output:
CODEBLOCK2
Troubleshooting
- - No subtitles found: Not all videos have subtitles. The script will report which languages are available.
- yt-dlp not found: Install with
brew install yt-dlp (macOS) or pip install yt-dlp. - Rate limited: Wait a moment and retry. YouTube occasionally throttles subtitle requests.
Links
YouTube 转录文本生成器
从任意YouTube视频链接下载干净的转录文本。
系统要求
- - 必须安装 yt-dlp(通过 brew install yt-dlp 或 pip install yt-dlp 安装)
使用方法
使用YouTube链接运行捆绑脚本:
bash
bash scripts/gettranscript.sh https://www.youtube.com/watch?v=VIDEOID
该脚本将:
- 1. 首先尝试下载英文手动字幕
- 回退到自动生成的英文字幕
- 如果英文不可用,则尝试所有可用语言
- 将原始字幕文件清理为可读段落
- 将转录文本输出到标准输出并保存至 transcriptVIDEOID.txt
选项
bash
保存到指定文件
bash scripts/get_transcript.sh URL output.txt
获取带时间戳的转录文本(默认:不带时间戳)
bash scripts/get_transcript.sh URL output.txt en timestamps
获取特定语言的转录文本
bash scripts/get_transcript.sh URL output.txt fr
工作原理
- 1. yt-dlp 下载字幕轨道(VTT/SRT格式)
- 脚本去除HTML标签和重复行
- 不带时间戳(默认): 合并为清晰可读的段落
- 带时间戳: 保留每行前的 [HH:MM:SS] 标记,便于参考
输出示例
输入:https://www.youtube.com/watch?v=HMTxOecbyPg
输出:
How OpenClaw Runs My Entire Business. I record a podcast episode and that is
literally the only thing I do. Everything else is handled by 13 AI agents
running on a Mac Mini in my office...
故障排除
- - 未找到字幕:并非所有视频都有字幕。脚本将报告哪些语言可用。
- 未找到 yt-dlp:使用 brew install yt-dlp(macOS)或 pip install yt-dlp 安装。
- 请求频率限制:稍等片刻后重试。YouTube偶尔会限制字幕请求。
相关链接