Proxy kullanmadan indirim
<form action="youtube.php" method="get">
<label for="item"> Video ID:</label>
<input name="item" id="item" type="text" size="30"><br>
<label for="type">Type:</label>
<select id="type" name="type">
<option value="0">Format FLV </option>
<option value="25">MP3 </option>
<option value="13">Format 3GP </option>
<option value="18">Format MP4</option>
<option value="22">Format MP4 (HD)</option>
</select> <label for="btget"> </label>
<input name="btget" id="btget" type="submit" class="boton" value="Download Video">
<br>
</form> <?php
function getContent($url) {
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_HEADER, 0);
ob_start();
curl_exec ($ch);
curl_close ($ch);
$string = ob_get_contents();
ob_end_clean();
return $string;
}
function fetch_headers($url) {
$headers = array();
$url = trim($url);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_NOBODY ,1);
$data = curl_exec($ch);
$errormsg = curl_error($ch);
curl_close($ch);
$headers = explode("\n", $data);
return $headers;
}
function getYoutubeToken($id) {
$path = "http://208.117.236.70/get_video_info?";
$cont = getContent($path."&video_id=".$id);
parse_str($cont, $opts);
return $opts['token'];
}
$videoItem = trim($_GET['item']);
$videoType = "";
$videoPath = "http://208.117.236.70/get_video";
if ($_GET['type'] != "0") {
$videoType = "&fmt=".$_GET['type'];
}
if ($videoItem != "") {
$videoTokn = getYoutubeToken($videoItem);
$videoURL = $videoPath."?video_id=".$videoItem."&t=".$videoTokn.$videoType;
$headers = fetch_headers($videoURL);
for ($i=0; $i<count($headers); $i++) {
if (strstr($headers[$i], "ocation:")) {
$str1 = explode("ocation:", $headers[$i]);
$link = trim($str1[1]);
break;
}
}
$link = str_replace("v18.lscache5.c.youtube.com", "v6.cache1.googlevideo.com", $link);
header("Location: ".$link);
exit;
}
?>