phpweb-scrapingyoutube

PHP: how to download YouTube videos?


I need to be able to directly download certain YouTube videos using PHP. Based on what I have read on the net, it seems like I need the video_id and t parameters of the Flash vars.

I have written code to grab these values from YouTube. So, for http://www.youtube.com/watch?v=YUBbTMdLD0Q, I get the following:

And from my understand, all I need to do next is download the file: http://www.youtube.com/get_video?video_id=YUBbTMdLD0Q&t=vjVQa1PpcFP86ZrlCWJMcfURrN-0uI5ElVojDbYC4nc%3D

This doesn't work. Suggestions?


Solution

  • well i did not accept any terms of use so here is a link to script that does what you want in an other language (JavaScript), but I am sure you can figure out how it works. It is MIT license so dont worry for legal terms here ^^

    http://userscripts.org/scripts/review/25105