I used to do this with a combination of yt-dlp and scraping the media links + wget, but it was quite the hassle. It's much easier to just torrent it.
Then you can setup a plex or jellyfin server to organise the torrents and ditch those unreliable free streaming sites for good.


