Skip to content

Instantly share code, notes, and snippets.

@sirenko
Created May 11, 2021 06:40
Show Gist options
  • Save sirenko/b4d6b7179441f5e1994b9df3aac531f5 to your computer and use it in GitHub Desktop.
Save sirenko/b4d6b7179441f5e1994b9df3aac531f5 to your computer and use it in GitHub Desktop.
Download
youtube-dl --sub-lang en --write-auto-sub --sub-format srt --skip-download 'https://www.youtube.com/watch?v=AAABBBCCCDDD'
#!/usr/bin/env bash
set -euo pipefail
## Clean up YT subtitles
# Usage:
# yt-subs2txt.sh subtitles.en.vtt
[ $# -ge 1 -a -f "$1" ] && input="$1" || input="-"
cat $input |\
grep -Ev '^0[0-9]*:' |\
sed -e 's/<[^>]*>//g' |\
grep "\S" |\
uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment