victories adlı üyeden alıntı:
mesajı görüntüle
basitçe aşağıdakini kullanabilirsiniz ancak tek iple sağlıklı çalışmaz, günde 2-3k istekten sonra youtube bir süre server ipinizi banlayacaktır.
Ayrıca bu kod, video boyutu X 2 bandwidth harcayacaktır.
Edit: Siz biliyorsunuzdur ama belki başkalarıda kullanmak ister, Kullanımı şu şekildedir. youtube.php?v=YOUTUBEID&fmt=36
fmt= değerini açıklama olarak koda yazdım, ordaki değerleri kullanarak diğer formatlarıda çekebilirsiniz.
Ayrıca bu kod, video boyutu X 2 bandwidth harcayacaktır.
Edit: Siz biliyorsunuzdur ama belki başkalarıda kullanmak ister, Kullanımı şu şekildedir. youtube.php?v=YOUTUBEID&fmt=36
fmt= değerini açıklama olarak koda yazdım, ordaki değerleri kullanarak diğer formatlarıda çekebilirsiniz.
<?php /* fmt 13 = 3gp Low Quality - 176x144 fmt 17 = 3gp Medium Quality - 176x144 fmt 36 = 3gp High Quality - 320x240 5 = flv Low Quality - 320x240 34 = flv Medium Quality - 400x226 18 = mp4 High Quality - 480x360 22 = mp4 High Quality - 1280x720 */ $videoid=$_GET["v"]; $format = $_GET["fmt"]; if(empty($format)) $format = 36; //17 $content= file_get_contents("http://www.youtube.com/get_video_info?video_id=$videoid"); parse_str($content); $url = "http://www.youtube.com/get_video.php?video_id=" . $videoid . "&t=" . $token. "&fmt=".$format; $headers = get_headers($url,1); if(!is_array($headers['Location'])) { $url = $headers['Location']; }else { foreach($headers['Location'] as $h){ if(strpos($h,"googlevideo.com")!=false){ $url = $h; break; } } } if(isset($_GET["debug"])){ print "URI: $url<br/>" ; echo "<pre>";print_r($headers); die("it's all folks!"); } if (($format == 13) || ($format == 17) || ($format == 36)) { $uzanti = "3gp"; } else if (($format == 5) || ($format == 34)) { $uzanti = "flv"; } else if (($format == 18) || ($format == 22)) { $uzanti = "mp4"; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_NOBODY, 0); curl_setopt($ch, CULROPT_REFERER, "http://www.google.com/"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_WRITEFUNCTION,"progress_function"); $data = curl_exec($ch); $i = 0; function progress_function($ch,$str) { global $i,$_GET,$uzanti; if($i == 0) { $info = curl_getinfo($ch); header('Content-type: video/x-flv'); header("Content-Disposition: attachment; filename=\"divxklip-" . $_GET['v'] . ".".$uzanti."\""); header("Content-Length: " . $info['download_content_length']); $i = 1; } echo $str; return strlen($str); } curl_close($ch); ?>Dilerseniz her 1 milyon gösterim 50tl olacak şekilde yardımcı olabilirim.