How to get video length of a youtube video in drupal7
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.