@ 2015-10-27T04:43:39Z <?php
namespace ZarkielMedia;
class Youtube{
private $videoMap = array(
"13" => array("3GP", "Low Quality - 176x144"),
"17" => array("3GP", "Medium Quality - 176x144"),
"36" => array("3GP", "High Quality - 320x240"),
"5" => array("FLV", "Low Quality - 400x226"),
"6" => array("FLV", "Medium Quality - 640x360"),
"34" => array("FLV", "Medium Quality - 640x360"),
"35" => array("FLV", "High Quality - 854x480"),
"43" => array("WEBM", "Low Quality - 640x360"),
"44" => array("WEBM", "Medium Quality - 854x480"),
"45" => array("WEBM", "High Quality - 1280x720"),
"18" => array("MP4", "Medium Quality - 480x360"),
"22" => array("MP4", "High Quality - 1280x720"),
"37" => array("MP4", "High Quality - 1920x1080"),
"38" => array("MP4", "High Quality - 4096x230")
);
private $videoPageUrl = 'http://www.youtube.com/watch?v=';
protected function getPageContent($id){
$page = $this->videoPageUrl.$id;
$content = file_get_contents($page);
return $content;
}
function getDownloadLinks($id){
$content = $this->getPageContent($id);
$videos = array('MP4' => array(), 'FLV' => array(), '3GP' => array(), 'WEBM' => array());
if(preg_match('/"url_encoded_fmt_stream_map": "(.*)"/iUm', $content, $r)){
$data = $r[1];
$data = explode(',', $data);
foreach($data As $cdata){
$cdata = str_replace('u0026', '&', $cdata);
$cdata = explode('&', $cdata);
foreach($cdata As $xdata){
if(preg_match('/^sig/', $xdata)){
$sig = substr($xdata, 4);
}
if(preg_match('/^url/', $xdata)){
$url = substr($xdata, 4);
}
if(preg_match('/^itag/', $xdata)){
$type = substr($xdata, 5);
}
}
$url = urldecode($url).'&signature='.$sig;
$videos[$this->videoMap[$type][0]][$this->videoMap[$type][1]] = $url;
}
}
return $videos;
}
}
$youtube = new ZarkielMediaYoutube();
$download_links = $youtube->getDownloadLinks('q_gfD3nvh-8');
print_r($download_links);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.0.0 - 8.0.30 , 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Fatal error: Uncaught Error: Class "ZarkielMedia\ZarkielMediaYoutube" not found in /in/hakoi:68
Stack trace:
#0 {main}
thrown in /in/hakoi on line 68
Process exited with code 255 . Output for 7.0.0 - 7.0.33 , 7.1.0 - 7.1.33 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 Fatal error: Uncaught Error: Class 'ZarkielMedia\ZarkielMediaYoutube' not found in /in/hakoi:68
Stack trace:
#0 {main}
thrown in /in/hakoi on line 68
Process exited with code 255 . Output for 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 Fatal error: Class 'ZarkielMedia\ZarkielMediaYoutube' not found in /in/hakoi on line 68
Process exited with code 255 . preferences:dark mode live preview
279.76 ms | 402 KiB | 375 Q