Here is a quick way to get the transcribe of any Youtube video. It will download the text/subtitle in .srt format and remove all empty lines and srt format strings, thus giving you only the text.
The text will be printed onto the screen, it doesn't save it to any file. You can pipe the text to any tool you like or save it to a file using pipes. A temp file which is created with mktemp will be disposed by the system.
I made it mainly to pass the text to an AI of some type, to get a summary from long talk videos, which at the end, may not even worth wathcing. This way i can save a lot of time.
It's using yt-dlp and grep so it can be used in any Linux system, as long you have installed yt-dlp.
So here is the script:
fl="$(mktemp)"
yt-dlp --skip-download --write-sub --write-auto-sub --sub-lang en --sub-format srt "$@" -o "$fl"
grep -v '\-\->' "$fl.en.srt" | grep -Exv '^[0-9]*'
As always, make it executable and execute it like: yttext.sh <youtube_url>


