This is a simple update for download Youtube videos with new links and regions....
Modify dvid.php
search:
Code:
// youtube.com, result = flv
if(preg_match("/http:\/\/(www\.)?youtube\.com\/watch\?v=([a-zA-Z0-9_]*)/i", $url, $sub)) {
$c = curl_init();
curl_setopt($c, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($c);
curl_close($c);
if(preg_match("/watch_fullscreen\?video_id=([0-9a-zA-Z]*)&l=[0-9]*&t=([0-9a-zA-Z\-]*)/i", $result, $d_link)) {
//header(sprintf("Location: http://cache.googlevideo.com/get_video?video_id=%s&t=%s", $d_link[1], $d_link[2], $d_link[3]));
printf("http://cache.googlevideo.com/get_video?video_id=%s&t=%s", $d_link[1], $d_link[2], $d_link[3]);
exit();
}
}
Replace with:
Code:
// youtube.com, result = flv
if(preg_match("/http:\/\/([a-z]*.)?youtube\.com\/watch\?v=([a-zA-Z0-9_%-]*)/i", $url, $sub)) {
$c = curl_init();
curl_setopt($c, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($c);
curl_close($c);
if(preg_match("/watch_fullscreen\?video_id=([a-zA-Z0-9_%-]*)&l=[0-9]*&t=([a-zA-Z0-9_%-\-]*)/i", $result, $d_link)) {
//header(sprintf("Location: http://cache.googlevideo.com/get_video?video_id=%s&t=%s", $d_link[1], $d_link[2], $d_link[3]));
printf("http://cache.googlevideo.com/get_video?video_id=%s&t=%s", $d_link[1], $d_link[2], $d_link[3]);
exit();
}
}