I'm trying to make an API for downloading YouTube videos as an MP3. I know this may be considered piracy but I am using it for educational reasons because this idea has been on my mind for a LONG time.
http://ift.tt/yEPeW4 Upon clicking the convert video button, multiple requests are sent to different hosts, one of which when I checked was some sort of RTB cookieless storage that I know nothing of. Along these are two GET requests from the host itself one which is labelled pushItem and another itemInfo. I've looked into itemInfo and its body response is a what I believe is a JSON string that looks like this:
info = {"title":"\"Divider\" by Chris Zabriskie","image":"http:\/\/i.ytimg.com\/vi\/eM6WxujEGy8\/default.jpg","length":"3","status":"serving","progress_speed":"","progress":"","ads":"","pf":"","pc":"d3b7.vd.aclst.com","h":"","px":"","ts_create":1485212542,"r":"OTIuMjM0LjcuOTc=","h2":"1074e4fb42576234c20e67c4e9434cbe"};
pushItem on the other hand has a response body which consists of the video ID and thats it. I dont know what that would be used for.
When clicking download a request with the video id is sent to another host, it then responds with a body of 3.2MB which is around the MP3's size. This obviously is how the file is downloaded. But another request is sent from the original host with some strange cookies and a status code of 302 which is a redirect.
Could someone maybe explain this? Is this too hard to replicate for a beginner who knows nothing about HttpWebRequests? And finally, if this would be too hard, can anyone maybe suggest an alternative where I can learn web requests?
Aucun commentaire:
Enregistrer un commentaire