<?php
error_reporting(E_ERROR);
$resolution[22]='720_mp4';
$resolution[18]='360_mp4';
$resolution[43]='360_webm';
$resolution[5]='240p_flv';
$resolution[36]='240p_3gp';
$resolution[17]='114p_3gp';
$data = 'http://www.youtube.com/watch?v=u7R4kdCi1zY';
//$data = file_get_contents($_GET['url']);
preg_match('/ytplayer.config = {(.*?)};/',$data,$match);
//debug($match);
$o = json_decode('{'.$match[1].'}') ;
$links = explode(',',$o -> args -> url_encoded_fmt_stream_map);
//print_r ($links);
foreach($links as $link)
{
parse_str($link,$r);
//echo $link." - ".$r."<br />";
print_r ($r);
//debug($r);
/* if ($r['s']) {
echo ('<a href="/domain.com/play.php?token='. urlencode($r['url']."&signature=".decrypt_sig($r['s'],'fr_FR-vflmo6Hkk/html5player')).'&fn=video.mp4">quality: '.$resolution[$r['itag']].'</a><br />');
}
else {
//$linkr = preg_replace("/googlevideo.com/","c.docs.google.com",$r['url']);
//$link = preg_replace("/http:/","https:",$linkr);
echo '<a href="'.$r['url'].'">quality: '.$resolution[$r['itag']].'</a><br />';
} */
//echo '<div>'.$r['s'].'</div>';
}
function decrypt_sig($s,$player_id) {
/* Methods / Commands for decrypting sig.
- r = reverse the string;
- sN = slice from character N to the end;
- wN = swap 0th and Nth character.
*/
$algo = array(
'fr_FR-vflmo6Hkk/html5player' => 'w8 s3 w45 w46 s2 w29 w25 w56 w2', // 26 sep 2014,
);
$method = explode(" ",$algo[$player_id]);
foreach($method as $m)
{
if($m == 'r')
$s = strrev($s);
else if( substr($m,0,1) == 's')
$s = substr($s, (int) substr($m,1) );
else if( substr($m,0,1) == 'w')
$s = swap($s, (int) substr($m,1));
//echo $m." - ".$s."<br />";
}
return $s;
}
function swap($a, $b) {
$c = $a[0];
$a[0] = $a[$b];
$a[$b] = $c;
return $a;
}
function getpage($url)
{
// fetch data
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
$data = curl_exec($curl);
curl_close($curl);
return $data;
}
function debug($str)
{
if(is_array($str) || is_object($str))
{
print '<pre>';
print_r($str);
print '</pre>';
}
else
echo $str;
}
//echo '<div>'.htmlspecialchars($data).'</div>';
?>
- Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
- Array
(
)
- Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
- Fatal error: Call to undefined function json_decode() in /in/f6bcv on line 21
Process exited with code 255. - Output for 4.4.5 - 4.4.9
- Fatal error: Call to undefined function: json_decode() in /in/f6bcv on line 21
Process exited with code 255. - Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
- Fatal error: Call to undefined function: json_decode() in /in/f6bcv on line 21
Process exited with code 255. - Output for 4.3.0 - 4.3.1
- Fatal error: Call to undefined function: json_decode() in /in/f6bcv on line 21
preferences:
59.41 ms | 409 KiB | 5 Q