Get youtube download token code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Get youtube download token code

    PHP Code:
    <?
    $token_code = get_video_token($_REQUEST['vid']);
    if($token_code == false)exit(0);
    else echo $token_code;

    function get_video_token($youtube_id,$extra='')
    {
        /* STEP 2. visit the homepage to set the cookie properly */
            $headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg'; 
            $headers[] = 'Connection: Keep-Alive'; 
            $headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8'; 
            $user_agent = '"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20071204 Ubuntu/7.10 (gutsy) Firefox/2.0.0.11';
            $url = 'http://www.youtube.com/';
            $ckfile = tempnam ("/tmp", "CURLCOO".rand(1,99)."KIE");
            $ch = curl_init ($url);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
            curl_setopt($ch, CURLOPT_HEADER, 1); 
            curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);

            curl_setopt($ch, CURLOPT_AUTOREFERER, 0);
            curl_setopt ($ch, CURLOPT_COOKIEJAR, $ckfile); 
            curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
            $output = curl_exec ($ch);
            $info_url = 'http://www.youtube.com/get_video_info?video_id='.$youtube_id.'';
            /* STEP 3. visit cookiepage */
            $ch = curl_init ($info_url);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
            curl_setopt($ch, CURLOPT_HEADER, 0); 
            curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
            curl_setopt($ch, CURLOPT_AUTOREFERER, 0);
            curl_setopt ($ch, CURLOPT_COOKIEFILE, $ckfile); 
            curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
            $output = curl_exec ($ch);
            $vars = explode('&', $output);
            foreach($vars as $var){ //search the headers for the location url of youtube video
                $variable = explode('=', $var, 2);
                $$variable[0] = $variable[1];
            }
        if($token!="")
        {
        return $token;
        } else return false;
    }
    ?>

    if someone knows other ways please let me know
    Advertise your mobile site for FREE with AdTwirl


    #2
    I use YouTube script that will search for videos

    this what i use as download page


    PHP Code:
    <?php

    $item 
    $_POST['item'];

    function 
    getContent($url) {
        
    $ch curl_init();
        
    curl_setopt ($chCURLOPT_URL$url);
        
    curl_setopt ($chCURLOPT_HEADER0);

        
    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($chCURLOPT_URL$url);
        
    curl_setopt($chCURLOPT_HEADER1);
        
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
        
    curl_setopt($chCURLOPT_NOBODY ,1);
        
    $data curl_exec($ch);
        
    $errormsg curl_error($ch);
        
    curl_close($ch);
                        
        
    $headers explode("\n"$data);
        return 
    $headers;
    }
    function 
    getYoutubeToken($id) {
        
    $path "http://www.youtube.com/get_video_info?";
        
    $cont getContent($path."&video_id=".$id);
        
    parse_str($cont$opts);
        return 
    $opts['token'];
    }


    $videoItem trim($_GET['item']);
    $videoType "";
    $videoPath "http://www.youtube.com/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;
            }
        }
        
    header("Location: ".$link);
        exit;
    }
    ?>
    Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
    Visit: WapMasterz Coming Back Soon!
    _______
    SCRIPTS FOR SALE BY SUBZERO
    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
    _______
    Info & Tips
    php.net
    w3schools.com

    Comment


      #3
      shh...
      why the site adds
      PHP Code:
      ????: Coding-Talk http://coding-talk.com/showthread.php?t=5153 
      to all posts
      PHP Code:
      <span class="copyright">????: Coding-Talk <a href="http://coding-talk.com/f46/get-youtube-download-token-code-5153/">http://coding-talk.com/f46/get-youtube-download-token-code-5153/</a></span> 
      Advertise your mobile site for FREE with AdTwirl

      Comment


        #4
        i dont know bro

        PHP Code:

        added 
        ?? 
        Got to test it lol

        its not always gets added in code it

        when ppl using scripting.
        Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
        Visit: WapMasterz Coming Back Soon!
        _______
        SCRIPTS FOR SALE BY SUBZERO
        Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
        FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
        _______
        Info & Tips
        php.net
        w3schools.com

        Comment


          #5
          in every post when people post code it added auto and make error for new users lol must be add // front if its a ads
          left wap stuff

          Comment


            #6
            Originally posted by subzero View Post
            i dont know bro

            PHP Code:

            added 
            ?? 
            Got to test it lol

            its not always gets added in code it

            when ppl using scripting.
            ok, fixed its gone now
            Advertise your mobile site for FREE with AdTwirl

            Comment


              #7
              Thank god for that error i did try to edit your post lol
              Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
              Visit: WapMasterz Coming Back Soon!
              _______
              SCRIPTS FOR SALE BY SUBZERO
              Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
              FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
              _______
              Info & Tips
              php.net
              w3schools.com

              Comment

              Working...
              X