Free youtube downloading php script...

Discussion in 'PHP' started by jehzlau, Nov 26, 2007.

  1. #1
    Can anyone give my the URL of that free youtube download script.. similar to this one..

    http://www.scriptonit.com/scripts/youtube/downloader/

    I found it last time here.. but i forgot to bookmark it.. that's why i lost it.. It's a website that has a free script similar to the URL above.. please anyone :(
     
    jehzlau, Nov 26, 2007 IP
  2. imvain2

    imvain2 Peon

    Messages:
    218
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I just put one together.

    Its a simple function that you supply the video's url, and the function returns the video's download url. If you run the example as is, the function will automatically redirect you and start downloading the file as get_video.flv.

    I'm not sure as how to force the file to be downloaded to a different file name.

    You can easily use this function to take a forms input.

    
    <?php
    	//PHP FUNCTION FOR GENERATING THE DOWNLOAD URL FOR YOUTUBE VIDEOS
    	function GetYouTubeVideoURL($InputURL){
    		//Download The Video's Page, and extract the T variable's content
    		$pagecontent = file_get_contents($InputURL);
    		$StartPos = strPos($pagecontent,"watch_fullscreen?video_id=");
    		$EndPos = strPos($pagecontent,";",$StartPos);
    		$pagecontent = substr($pagecontent, $StartPos, $EndPos);
    		$findstr = preg_match("/t=([^(\&|$)]*)/", $pagecontent,$matches);
    		$T_ID = $matches[1];
    		
    		//Extract The Video's ID from the Given URL
    		$findstr = preg_match("/v=([^(\&|$)]*)/", $InputURL,$matches);
    		$VideoID = $matches[1];
    		//Start creating the video's URL
    		$YouTubeVideoURL = "http://youtube.com/get_video?video_id=". $VideoID;
    		$YouTubeVideoURL = $YouTubeVideoURL . "&t=" . $T_ID;
    		
    		return $YouTubeVideoURL;
    }
    		//EXAMPLE USAGE
    		$VideoURL = GetYouTubeVideoURL("http://youtube.com/watch?v=aFgJwRUojKw");
    		header("Location: " . $VideoURL);
    ?>
    
    PHP:
     
    imvain2, Nov 27, 2007 IP
  3. jehzlau

    jehzlau Active Member

    Messages:
    301
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    73
    #3
    wow thanks for this imvain2 :p it's exactly what I am looking for :)
     
    jehzlau, Nov 30, 2007 IP
  4. imvain2

    imvain2 Peon

    Messages:
    218
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Great, I'm glad that is what you were looking for.
     
    imvain2, Nov 30, 2007 IP
  5. jehzlau

    jehzlau Active Member

    Messages:
    301
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    73
    #5
    thanks again imvain2 :)
     
    jehzlau, Nov 30, 2007 IP
  6. redfaithless

    redfaithless Peon

    Messages:
    70
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Please show me how to make a form that will call to that script, and returns the download url.
     
    redfaithless, Feb 1, 2008 IP
  7. imvain2

    imvain2 Peon

    Messages:
    218
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #7
    imvain2, Feb 1, 2008 IP