• 18-09-2009, 20:17:57
    #1
    <?php
     
        /** Configuration
        */
        $cache_url = 'cache.xml'; //Cache URL
        $cache_time = 30; //If empty, no Cache
     
        $video_id = $_GET['v'];
     
        /**
        */
        parse_str(file_get_contents("http://youtube.com/get_video_info?video_id={$video_id}"),$i);
        if($i['status'] == 'fail' && $i['errorcode'] != '150') die(header("Location: errors/error01.mp4")); //Error
     
        if($i['status'] == 'fail') { //Error code is 150 
            //Cache File (suggestion from @burkul)
            if(!isset($cache_url)) $cache_url = "cache.xml";
            $cache = file_get_contents($cache_url);
            if( time() - $cache  < $cache_time && isset($cache_time)) die(header("Location: errors/error02.mp4"));
                $cache = fopen($cache_url, "w");
                fwrite($cache, time());
                fclose($cache);
            //
            $content = file_get_contents("http://www.youtube.com/watch?v={$video_id}");
            preg_match_all ("/(\\{.*?\\})/is", $content, $matches); 
            $obj = json_decode($matches[0][1]);
     
            $token = $obj->{'t'}; $fmt_map = $obj->{'fmt_map'}; $fmt_url_map = $obj->{'fmt_url_map'};
        }
        else { //No error code
            $token = $i['token']; $fmt_map = $i['fmt_map']; $fmt_url_map = $i['fmt_url_map'];
        }
     
        //Video Format
        if(!isset($fmt_map)) die(header("Location: errors/error03.mp4"));
        preg_match_all ("/(.*?),/is", $fmt_map, $fmt_map);
        foreach( $fmt_map[1] as $fmt_i => $fmt_value){
            $fmt_value = explode('/',$fmt_value);
            if ($fmt_value[0] == 6) {$fmt = 6;} else{$fmt = 5;} //Highest .MP4 Format
        }
        $url = "http://www.youtube.com/get_video.php?video_id={$video_id}&vq=2&fmt={$fmt}&t={$token}";
        $headers = get_headers($url,1);
     
        $video = $headers['Location'];
        if(!isset($video)) {
            $fmt_url_map = explode(',',$fmt_url_map);
            foreach( $fmt_url_map as $fmt_i => $fmt_url){
                $fmt_url = explode('|',$fmt_url);
                if($fmt_url[0] == 6 || $fmt_url[0] == 5) $video = $fmt_url[1]; break;
            }
        }
        if(!isset($video)) die(header("Location: errors/error01.mp4"));
     
        is_array($video) ? $video = $video[0] : $video = $video;
        header("Location: $video"); //Return Video
    ?>
    Youtube videolarını bu script sayesinde istediğiniz formatta indirtebilirsiniz. Türkçe bir çok kaynakta aramama rağmen çalışanını bulamamıştım. En sonunda yabancı bir forumda bulup lâzım olur diye arşivime atmıştım. Şimdi denk gelince sizlerle paylaşmak istedim. Çalıştıramayan yada anlamayan olursa konu altında yardımcı olmaya çalışırım.

    Ayrıca indirtmek yerine playerınızda dinlettirmeyi/oynatmayı da tercih edebilirsiniz. Ah şu youtube videolarının logosuz ve yalın hâlini bir alabilseydim dediğiniz işi yapan script diye açıklayayım kısaca.

    Download : Tıklayın
  • 18-09-2009, 20:20:45
    #2
    Kodlar içerisindeki fmt parametresi formatı temsil etmektedir. Ben sizlere rehber olması açısından derlediğim ek notu aktarayım :

    fmt=? HQ FLV 480x320 1.5:1 3:2 H.263 MP3
    fmt=5 LQ FLV 320x180 1.7:1 16:9 FLV1 MP3
    fmt=6 HQ FLV 480x360 1.3:1 4:3 H.263 MP3
    fmt=18 HQ MP4 480x270 1.7:1 16:9 AVC AAC
    fmt=? HQ FLV 534x360 1.4:1 6:4 AVC AAC
    fmt=22 HQ MP4 1280x720 1.7:1 16:9 AVC AAC
    fmt=34 LQ FLV 320x180 1.7:1 16:9 ? ?
    fmt=35 HQ MP4 640x360 1.7:1 16:9 AVC AAC
  • 18-09-2009, 20:44:28
    #3
    https://www.r10.net/php/431005-ucrets...-duymayan.html

    burda gerekli kodları vermiş açıklamaları yapılmıştı,

    sizin verdiğiniz code.google.com da yayınlanan yts'nin ilk versiyonudur. şu anda 2.1 versiyonu var,

    Downloads - yts - Project Hosting on Google Code
  • 18-09-2009, 20:59:34
    #4
    Hmmm.. ben bilmiyordum teşekkürler. Yardımcı olurum diyeyim o zaman buradan