Youtube streams can expire, you need to handle those if you aren't downloading the file directly. You can try reconnect or retry options in youtube_dl or ffmpeg, or you can create a function/method that will handle it. Some examples from old answers, may be outdated: stackoverflow.com/questions/66610012/…
– Benjin
Commented Jun 24 at 8:18
yes this works