Created
October 8, 2022 09:02
-
-
Save neuthral/d86c4825e03b21e1789977832684f532 to your computer and use it in GitHub Desktop.
youtube get video subtitles and cleant up the file for readability
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
youtube-get-subs() { | |
echo "getting filenames..." | |
filename=$(youtube-dl --simulate --get-title $1)-$(youtube-dl --simulate --get-id $1) | |
echo "Downloading video data" | |
youtube-dl --continue --write-auto-sub --sub-format vtt --sub-lang en --write-thumbnail --write-description --skip-download $1 | |
echo $filename | |
echo "Removing --> time stuff" | |
sed -i '/-->/d' $filename.en.vtt | |
echo "Removing empty lines" | |
grep "\S" $filename.en.vtt > $filename.txt | |
echo "Deleting old subtitle file" | |
rm $filename.en.vtt | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment