Download video da YouTube – script PHP
Link sponsorizzati
Ecco un semplice script per scaricare video da YouTube scritto in PHP.
<form action="" method="post">
Inserisci il link es. (http://www.YouTube.com/LINK):<br /> <input type="text" name="link" size="50" /><input type="submit" value="Preleva link" /><br />
Per esempio, se il link è http://www.youtube.com/watch?v=1izVBRZCleo devi inserire <b>watch?v=1izVBRZCleo</b>
</form>
<?php
if(!empty($_POST['link'])) {
$uri = ($_POST['link'][0] != '/' ? "/".trim($_POST['link']) : trim($_POST['link']));
$sito = 'www.YouTube.com';
$f = getFile($uri, $sito);
if($f) {
$f = explode("fmt_url_map\": \"", $f);
$d = explode("\"", $f[1]);
$link = explode("|",urldecode($d[0]));
echo "<center><h4>Link to file:</h4> <textarea cols='50' rows='10'>".urldecode($link[2])."</textarea>";
}else echo "Bad link";
}
function getFile($url, $sito) {
$other_info = "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.9) Gecko/2008052906 Firefox/3.0\r\n".
"Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3\r\n".
"Keep-Alive: 300\r\n".
"Connection: Keep-Alivern\r\n\r\n";
if (!($sock = fsockopen($sito,80)))
die ("Errore connessionen");
fputs ($sock,
"GET $url HTTP/1.1\r\n".
"Host: $sito\r\n".$other_info);
$f = "";
while (!feof($sock))
$f .= fgets($sock);
fclose($sock);
return $f;
}
?>
Inserisci il link es. (http://www.YouTube.com/LINK):<br /> <input type="text" name="link" size="50" /><input type="submit" value="Preleva link" /><br />
Per esempio, se il link è http://www.youtube.com/watch?v=1izVBRZCleo devi inserire <b>watch?v=1izVBRZCleo</b>
</form>
<?php
if(!empty($_POST['link'])) {
$uri = ($_POST['link'][0] != '/' ? "/".trim($_POST['link']) : trim($_POST['link']));
$sito = 'www.YouTube.com';
$f = getFile($uri, $sito);
if($f) {
$f = explode("fmt_url_map\": \"", $f);
$d = explode("\"", $f[1]);
$link = explode("|",urldecode($d[0]));
echo "<center><h4>Link to file:</h4> <textarea cols='50' rows='10'>".urldecode($link[2])."</textarea>";
}else echo "Bad link";
}
function getFile($url, $sito) {
$other_info = "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.9) Gecko/2008052906 Firefox/3.0\r\n".
"Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3\r\n".
"Keep-Alive: 300\r\n".
"Connection: Keep-Alivern\r\n\r\n";
if (!($sock = fsockopen($sito,80)))
die ("Errore connessionen");
fputs ($sock,
"GET $url HTTP/1.1\r\n".
"Host: $sito\r\n".$other_info);
$f = "";
while (!feof($sock))
$f .= fgets($sock);
fclose($sock);
return $f;
}
?>
Qui la versione online, inserita nel solito sito, che potete provare.
Link sponsorizzati
Link sponsorizzati


Ciao, ho provato ad inserire questo codice all’interno del mio sito web ma fa comparire una textbox completamente vuota, sai darmi una mano?
Si, è li che devi mettere il link del video di youtube.