Back to cheatsheets

Shell

Download YouTube transcript with yt-dlp

Install yt-dlp first.

brew install yt-dlp

Or with pip:

pip install yt-dlp

List available subtitles for a video.

yt-dlp --list-subs "https://www.youtube.com/watch?v=VIDEO_ID"

Download manual subtitles in English without downloading the video.

yt-dlp --write-subs --sub-lang en --skip-download "https://www.youtube.com/watch?v=VIDEO_ID"

Download auto-generated subtitles.

yt-dlp --write-auto-subs --sub-lang en --skip-download "https://www.youtube.com/watch?v=VIDEO_ID"

Download both manual and auto-generated subtitles, then convert to SRT.

yt-dlp --write-subs --write-auto-subs --sub-lang en --convert-subs srt --skip-download -o "%(title)s" "https://www.youtube.com/watch?v=VIDEO_ID"

Download subtitles for every video in a playlist.

yt-dlp --write-auto-subs --sub-lang en --convert-subs srt --skip-download -o "%(playlist_index)s-%(title)s" "https://www.youtube.com/playlist?list=PLAYLIST_ID"

See other cheatsheet's here