views:

219

answers:

3

I want to get number of views, duration and also the rating of the particular video in youtube. Is there any way to get the information of the video by passing the video id through URL?

A: 

for the rating, you can parse the video url and find:

<button class="master-sprite ratingL ratingL-5.0" title="5.0"></button></div><div id="ratingMessage" ><div id="defaultRatingMessage"><span class="smallText">719 ratings

notice 5.0 and 719 here. 5.0 is the rating and 719 is the number of votes.

Yin Zhu
+3  A: 

Youtube Data API.

Basically, you want to fetch a URL like http://gdata.youtube.com/feeds/api/videos/kpcqAm8BOlE and look at the resulting XML.

itsadok
+1  A: 

The article Retrieve Title, Description and Thumbnail of a YouTube Video Using AJAX describes how you can do this via simple JavaScript and/or AJAX. It uses the YouTube Data API but the the code example here is to-the-point so that you don't get lost searching the API documentation.

Salman A