Receive raw YouTube video bitstream via code

Viewed 295

I'm looking into creating a video decoding tool, one capable of receiving and decoding the bitstream of a YouTube video. The problem is I can't seem to find how specifically I request and receive the aforementioned bitstream, or what format the data is in. The platform I am developing this tool on is a game engine, and does not have HTML support or JavaScript support. The only tool at my disposal is HTTP requests.

1 Answers

You can use the nice package https://github.com/ytdl-org/youtube-dl along with Process.

NB: It is not illegal, illegal means against the law, and scraping has been ruled as legal (cf LinkedIn case). Specifically, it is up to companies to efficiently protect access to their resources. However it is certainly against youtube policy, so you expose yourself to lawsuits etc (but honestly I dont think they would either track you or bother).

Most likely they would blacklist your IP if they find out that you (and your clients) are consuming too much data, and simultaneous requests.

Disclaimer: I am not a lawyer, and I am not liable for the legal issues that would arise if you go down that road.

Edit: about github reinstating youtube-dl: https://github.blog/2020-11-16-standing-up-for-developers-youtube-dl-is-back/

Thanks to the wikipedia page, you get a clear explanation that they are using a rolling cypher (probably based on video id but not necessarily) to generate link of the video.

Related