You tube video parameters (how to get parameters details from the youtube url)

$video_query = parse_url($_REQUEST[‘youTubeUrl’]);
$video_vars = array();
parse_str($video_query[‘query’], $video_vars);
$video_code = $video_vars[‘v’];
$video_info_json = @file_get_contents(“http://gdata.youtube.com/feeds/api/videos/{$video_code}?alt=json”);
$video_info = ( $video_info_json ) ? json_decode($video_info_json, true) : array();
$video_title = isset($video_info[‘entry’][‘title’][‘$t’]) ? $video_info[‘entry’][‘title’][‘$t’] : ”;
$video_description = isset($video_info[‘entry’][‘content’][‘$t’]) ? $video_info[‘entry’][‘content’][‘$t’] : ”;
$video_duration = isset($video_info[‘entry’][‘media$group’][‘yt$duration’][‘seconds’]) ? $video_info[‘entry’][‘media$group’][‘yt$duration’][‘seconds’] : ”;
$video_thumb = isset($video_info[‘entry’][‘media$group’][‘media$thumbnail’][3]) ? $video_info[‘entry’][‘media$group’][‘media$thumbnail’][3] : ”;
//$video_result[‘player’] = ”;
$video_result = ”;
//$videoEmbedUrl = ‘http://www.youtube.com/embed/’.$video_code;

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Advertisements
%d bloggers like this: