Youtube video data retrieval

2019-07-21 01:14发布

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?

3条回答
我只想做你的唯一
2楼-- · 2019-07-21 01:30

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.

查看更多
干净又极端
3楼-- · 2019-07-21 01:37

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.

查看更多
forever°为你锁心
4楼-- · 2019-07-21 01:48

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.

查看更多
登录 后发表回答