Widze sami specjaliści.. przecież youtube dostarcza API do takich rzeczy..
private function _get_links() {
#$video_id = $this->parent->info['video_id'];
$video_id = $this->id;
$info_url = "http://www.youtube.com/get_video_info?video_id={$video_id}";
//$request =& $this->parent->request;
$request = new HTTP_Request2;
$request->setUrl( $info_url );
$request->setMethod( HTTP_Request2::METHOD_GET );
$response = $request->send();
$response_body = $response->getBody();
$video_info;
$video_links = urldecode( $video_info['url_encoded_fmt_stream_map'] ); $video_links = explode( ',itag=', $video_links ); $video_links[0
] = ltrim( $video_links[0], 'itag=' );
# var_dump($video_links);exit;
for ( $i = 0
, $j = count( $video_links ); $i < $j; $i++ ) {
$video_link = $video_links[$i];
$video = explode( '&url=', $video_link );
// Get information of type of video
preg_match('#(^|\D)'.$video[0].'/([0-9]{2,4}x[0-9]{2,4})#', $video_info['fmt_list'], $format);
// Repair link
// Create array of information of video
$key = $this->_formats[ $video[0] ] . '-' . $format[2];
'format' => $this->_formats[ $video[0] ],
'resolution' => $format[2],
'url' => $video[1],
);
$output[ $key ] = $val;
}
// sortujemy...
$output = $this->_sort_links( $output );
return $output;
}