How to get video length of a youtube video in drupal7 I created a node in drupal7 which contains a youtube link. I installed youtube module in my site. with the help of this module i just created a field for inputting url to youtube video.
every thing worked fine. It is showing me the thumbnail,video etc. 
But the problem is how to get the length of the youtube video ?

I am using views to generate a json web service the output is 

{
            "title":"social networking",
            "field_eventcat":"Performing Arts",
            "field_eventdaytime":"06\/06\/2012 - 05:00",
            "field_eventvideos":"http:\/\/sample sites\/sites\/default\/files\/styles\/thumbnail\/public\/youtube\/6a_KF7TYKVc.png",
            "nid":"34"
         }


I want to get the video lenght with this object. pls help
You can follow the function youtube_get_remote_image on how to make a call to youtube api and retrieve video length. 

Youtube public api provides this info without any authentication, for instance - http://gdata.youtube.com/feeds/api/videos/dc4UltkRJsw contains video length in the tag: yt:duration. I have not tested the below function, but should work.

function youtube_get_video_length($id = NULL) {
  $path = 'http://gdata.youtube.com/feeds/api/videos/' . $id;
  $query = array(
   'v' =&gt; '2',
   'alt' =&gt; 'jsonc'
 );
  $url = url($path, array('query' =&gt; $query));
  $result = drupal_http_request($url);
  $data = json_decode($result-&gt;data);
  $video_length = $data-&gt;data-&gt;duration;
  return $video_length;
 }


Also I dont suggest that you write this in youtube.inc of youtube module, write in your custom module or template.php of custom theme. 

Hope that helps.