Download videos
Install yt-dlp.
1yt-dlp --write-auto-sub ${url}
It will default to English, but you can specify another language with the flag --sub-lang:
1yt-dlp --sub-lang sv --write-auto-sub ${url}
You can list all available subtitles with:
1yt-dlp --list-subs ${url}
It's also possible to skip the video and only download the subtitle if you add the flag --skip-download:
1yt-dlp --sub-lang sv --write-auto-sub --skip-download ${url}