I'm using this function to get YouTube video length in seconds
function getDuration($url){
parse_str(parse_url($url,PHP_URL_QUERY),$arr);
$video_id=$arr['v'];
$data=@file_get_contents('http://gdata.youtube.com/feeds/api/videos/'.$video_id.'?v=2&alt=jsonc');
if (false===$data) return false;
$obj=json_decode($data);
return $obj->data->duration;
}
But all videos return duration 236 like this video which its duration is 42 minutes and 45 seconds here's the sample
http://gdata.youtube.com/feeds/api/videos/gXGn06tuvZM?v=2&alt=jsonc
is this something wrong with the function or with the youtube api as I noticed when I open youtube website all videos' duration has gone as in the image