Either of these can help. Just call it with a video url.
https://github.com/yt-dlp/yt-dlp
https://mpv.io/