************************************************************************************/ // ------------------------------------ START SCRIPT --------------------------// ini_set('user_agent','Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; AnomiSurf)'); if($_GET['youtube']) { $download = download_youtube($_GET['youtube']); header("Location: $download"); } else { echo ('Error'); } function get_http_header($url){ $uh = curl_init(); curl_setopt($uh, CURLOPT_URL, $url); curl_setopt($uh, CURLOPT_HEADER, 1); curl_setopt($uh, CURLOPT_RETURNTRANSFER, 1); $res = curl_exec($uh); curl_close($uh); return $res; } function show_url($http_header){ $arai = explode("\n",$http_header); foreach($arai as $ini){ if(eregi("location",$ini)) $url = $ini; } list($sampah,$hasil) = explode("Location:",$url); return str_replace("\n","",trim($hasil)); } function download_youtube($url){ if(ereg('&',$url)){ if (eregi("watch\?v=(.*)&", $url, $out)) { $video_id = $out[1]; } } else{ list($none,$video_id) = explode('watch?v=',$url); } $header = get_http_header('http://youtube.com/v/'.trim($video_id)); $secret_link = show_url($header); list($none,$dl_url) = explode("/swf/l.swf?",$secret_link); $video_url = 'http://youtube.com/get_video?'.$dl_url; return $video_url; } // ------------------------------------ END SCRIPT --------------------------// ?>