Re:Show HN: I create a free website for download YouTube tra...
by rspoerri on Sunday February 18, 2024 @12:11PM
(#39420816)
I use this script, because automatically generated subtitles are badly formatted as transcript (only good as subtitles). It works pretty well to archive the videos including the transcript and subtitles.
```
#!/bin/zsh
# download as mp4, get normal subtitles
yt-dlp -f mp4 "$@" --write-auto-sub --sub-format best --write-sub
# download subtitles and convert them to transcript
```
#!/bin/zsh
# download as mp4, get normal subtitles
yt-dlp -f mp4 "$@" --write-auto-sub --sub-format best --write-sub
# download subtitles and convert them to transcript
yt-dlp --skip-download --write-subs --write-auto-subs --sub-lang en -k --sub-format ttml --convert-subs srt --exec before_dl:"sed -e '/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9] --> [0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9]$/d' -e '/^[[:digit:]]\{1,3\}$/d' -e 's/<[^>]>//g' -e '/^[[:space:]]$/d' -i '' %(requested_subtitles.:.filepath)#q" "$@"
```