-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Also Exception due to variable "videos" #7
Comments
Make sure your /**
* Get the URL map for a YouTube Video.
* @access private
* @param string $data Info-File contents for a YouTube Video.
* @return mixed Returns an array, containg the Video URL map,
* or (boolean) FALSE if extracting failed.
*/
private function get_url_map($data)
{
$videos = false;
preg_match('/stream_map=(.[^&]*?)&/i',$data,$match);
if(!isset($match[1])) {
return FALSE;
}
else {
$fmt_url = urldecode($match[1]);
if(preg_match('/^(.*?)\\\\u0026/',$fmt_url,$match2)) {
$fmt_url = $match2[1];
}
$urls = explode(',',$fmt_url);
$tmp = array();
foreach($urls as $url) {
if(preg_match('/itag=([0-9]+)&url=(.*?)&.*?/si',$url,$um))
{
$u = urldecode($um[2]);
$tmp[$um[1]] = $u;
}
}
$formats = array(
'13' => array('3gp', '240p', '10'),
'17' => array('3gp', '240p', '9'),
'36' => array('3gp', '320p', '8'),
'5' => array('flv', '240p', '7'),
'6' => array('flv', '240p', '6'),
'34' => array('flv', '320p', '5'),
'35' => array('flv', '480p', '4'),
'18' => array('mp4', '480p', '3'),
'22' => array('mp4', '720p', '2'),
'37' => array('mp4', '1080p', '1')
);
foreach ($formats as $format => $meta) {
if (isset($tmp[$format])) {
$videos[] = array('pref' => $meta[2], 'ext' => $meta[0], 'type' => $meta[1], 'url' => $tmp[$format]);
}
}
return $videos;
}
} Note: Another Note: This same content is also passed to Youtube's Flash Player (using javascript to send flash vars to the player) on the regular video viewing page, for example: http://www.youtube.com/watch?v=aahOEZKTCzU, this was how I about 2 years ago did something like this Hope this helps you, and anybody else seeking to update this function, everytime Youtube changes it's own method of making streams available to it's own player. Whenever time allows it, I will too post answers to other issues. |
Hey, I also get an error: "Notice: Undefined variable: videos in var/www/youtube_graph/youtube-dl.class.php on line 534
Grabbing original file location(s) failed."
Can you tell whats wrong there?
The text was updated successfully, but these errors were encountered: