Posted By

jacksont123 on 07/01/08


Tagged

link generator video download YouTube jacksont123


Versions (?)

Who likes this?

7 people have marked this snippet as a favorite

jacksont123
SpinZ
navjotjsingh
Oldarney
motionmediasolutions
Balamir
catrinho


Youtube Download Link Generator


 / Published in: PHP
 

URL: http://youtube.com

YouTube Video Download Link Generator free for all to use, successfulness can't be guaranteed

  1. //YouTube Video Download Link Generator -- jacksont123 (2008)
  2. function str_between($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len); }
  3. function get_youtube_download_link(){
  4. $youtube_link = $_GET['youtube'];
  5. $youtube_page = file_get_contents($youtube_link);
  6. $v_id = str_between($youtube_page, "&video_id=", "&");
  7. $t_id = str_between($youtube_page, "&t=", "&");
  8. $flv_link = "http://www.youtube.com/get_video?video_id=$v_id&t=$t_id";
  9. $hq_flv_link = "http://www.youtube.com/get_video?video_id=$v_id&t=$t_id&fmt=6";
  10. $mp4_link = "http://www.youtube.com/get_video?video_id=$v_id&t=$t_id&fmt=18";
  11. $threegp_link = "http://www.youtube.com/get_video?video_id=$v_id&t=$t_id&fmt=17";
  12. echo "\t\tDownload (right-click > save as):\n\t\t";
  13. echo "<a href=\"$flv_link\">FLV</a>\n\t\t";
  14. echo "<a href=\"$hq_flv_link\">HQ FLV (if available)</a>\n\t\t";
  15. echo "<a href=\"$mp4_link\">MP4</a>\n\t\t";
  16. echo "<a href=\"$threegp_link\">3GP</a><br><br>\n";
  17. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: navjotjsingh on November 7, 2008

Excellent and so easy to implement! Works wonderfully!

Posted By: Oldarney on August 15, 2009

Awesome. Although it doesn't work these days. Aparently you tube updated. It isn't too hard to make it work again. I just switched the vid and the tid variables to some other value...

You need to login to post a comment.