Manoj Kumar
Manoj Kumar

Reputation: 370

Youtube video data retrieval

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?

Upvotes: 2

Views: 1156

Answers (3)

Salman Arshad
Salman Arshad

Reputation: 272006

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.

Upvotes: 2

itsadok
itsadok

Reputation: 29332

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.

Upvotes: 7

Yin Zhu
Yin Zhu

Reputation: 17119

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.

Upvotes: 0

Related Questions