Domain Discussion Board

Go Back   Domain Discussion Board > Web Hosting & Web Design > Scripts

 
Reply
 
LinkBack Thread Tools Display Modes
Youtube Dowloader Script construction and Download
Old
  (#1 (permalink))
MWR
Junior Member
MWR is on a distinguished road
 
Status: Offline
Posts: 12
Points: 355.3
Bank: 0.0
Total Points: 355.3
Donate
Join Date: Oct 2008
Rep Power: 0
Youtube Dowloader Script construction and Download - 10-06-2008, 04:49 PM

At the request of our visitors are presenting PHP Youtube Downloader 2.0 which is the new version of the PHP script that allows you to download videos from YouTube using PHP. This new version is adapted to the new data structure of Youtube.



Note: This information is for educational purposes, the author is not responsible for the uses that can make users of this information

How does it work?
For a detailed explanation of how the paths of Youtube can read: Constructing YouTube FLV URL on client-side without any server-side script. But summing up when you want to access a video from Youtube, the first generating a session identifier that is returned to the user and then makes the call to the video with the identifier of the video and the session identifier of the form:

HTML Code:
http://www.youtube.com/get_video.php?video_id=idvideo&t=idsesion
So to get the videos, our goal is to get the idsesion to build the final route of the download.

Implementing
The first thing we do is build a function that connects to Youtube and get the headers of the initial response to the request of the video, among these headers will be the identifier we need. Note that this function receives the identifier as a parameter of the video.

PHP Code:
function getHeaders($varurl) {    $host "www.youtube.com";    $url "/v/".$varurl;    $session "";    $fp fsockopen ($host80$errno$errstr45);    if ($fp) {        fputs ($fp"GET $url HTTP/1.0\r\n\r\n");        while (!feof($fp)) {            $char fgetc($fp);            if($char === "\n") {                if (ord($header) === 13) {                     return($session);                } else {                    $arrValue split(": "trim($header));                    if ($arrValue[0] == "Location") {                        parse_str($arrValue[1], $getvars);                        $session $getvars['t'];                    }                }                unset($header);            } else {                 $header $header.$char;            }        }        fclose ($fp);    }} 
El siguiente paso es crear la URL con la ruta final del vídeo que deseamos acceder, en nuestro caso estamos recibiendo el identificador del vídeo por método GET de un formulario y estamos construyendo el URL mostrado al inicio en donde obtenemos el identificador de sesión haciendo uso de la función getHeaders.
PHP: if ($_GET['v'] != "") {    $videoIds $_GET['v'];    $videoUrl "http://www.youtube.com/get_video.php";    header("Location: ".$videoUrl."?video_id=".$videoIds."&t=".getHeaders($videoIds));    exit();} 
Uniting the code, adding a form where the user enters the id of the movie we get the new version of our tool to download videos from YouTube just using PHP. You can see the example in running: http://ejemplos.unijimpe.net/phpyoutube.php

Finally they leave the source files of this example so that it can revise and improve.

Download:
phpyoutube2.0.zip - File Shared from Box.net - Free Online File Storage

Source:
Unjimpe.net

Traduction:
By my

Last edited by MWR : 10-07-2008 at 04:35 PM.
   
Reply With Quote
Re: Youtube Dowloader Script construction and Download
Old
  (#2 (permalink))
geekspassion
Platinum Member
geekspassion is an unknown quantity at this point
 
geekspassion's Avatar
 
Status: Offline
Posts: 2,042
Points: 367.4
Bank: 2,162.8
Total Points: 2,530.2
Donate
Join Date: Nov 2006
Location: PHILIPPINES
Rep Power: 0
Re: Youtube Dowloader Script construction and Download - 10-06-2008, 07:46 PM

Thanks! another cool script for my new domain
   
Reply With Quote
Sponsored Links
Re: Youtube Dowloader Script construction and Download
Old
  (#3 (permalink))
MWR
Junior Member
MWR is on a distinguished road
 
Status: Offline
Posts: 12
Points: 355.3
Bank: 0.0
Total Points: 355.3
Donate
Join Date: Oct 2008
Rep Power: 0
Re: Youtube Dowloader Script construction and Download - 10-07-2008, 04:34 PM

Is veri util man and easy de install.
   
Reply With Quote
Re: Youtube Dowloader Script construction and Download
Old
  (#4 (permalink))
jaime
jaime is an unknown quantity at this point
 
jaime's Avatar
 
Status: Offline
Posts: 1,716
Points: 1.2
Bank: 6,053.5
Total Points: 6,054.7
Donate
Join Date: May 2006
Location: In your mind
Rep Power: 0
Re: Youtube Dowloader Script construction and Download - 10-07-2008, 06:42 PM

Thanks, very nice this script....
   

Reply With Quote
Re: Youtube Dowloader Script construction and Download
Old
  (#5 (permalink))
hydroburn
hydroburn is on a distinguished road
 
hydroburn's Avatar
 
Status: Offline
Posts: 2,612
Points: 68.6
Bank: 2,109.2
Total Points: 2,177.7
Donate
Join Date: Mar 2007
Location: www.sgwebster.com
Rep Power: 4
Re: Youtube Dowloader Script construction and Download - 10-08-2008, 12:44 AM

does it utilise bandwidth off our servers?
   
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Points Per Thread View: 0.1
Points Per Thread: 15.0
Points Per Reply: 5.0


Similar Threads
Thread Thread Starter Forum Replies Last Post
Construction Machinery & Equipment Database - 53,349 Records odditysoftware Member Advertising 0 10-22-2006 07:55 PM


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 ©2007, Crawlability, Inc.