Umerm
Umerm

Reputation: 155

Get view and watch time history of any youtube video

Is it possible to find watch time and view history of any youtube video through youtube API ? If yes than how ? and if no, then please tell any alternative to it.thanks

Upvotes: 1

Views: 3233

Answers (2)

KENdi
KENdi

Reputation: 7751

Yes, you can do it through API. Just use the Videos: list of the YouTube Data API. Use statistics as your part parameter and just place the videoId of the video that you want to get in the id parameter.

Here is the sample request.

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?part=statistics&id=y64OsZNYhp0&_h=2&

And this is the response that you will get.

{
 "kind": "youtube#videoListResponse",
 "etag": "\"uQc-MPTsstrHkQcRXL3IWLmeNsM/qVhz5oG-YjkUw2MI_dGWHLSoyqw\"",
 "pageInfo": {
  "totalResults": 1,
  "resultsPerPage": 1
 },
 "items": [
  {


   "kind": "youtube#video",
   "etag": "\"uQc-MPTsstrHkQcRXL3IWLmeNsM/tNAz0qXkqB5wXksK0L-_QxgvMKI\"",
   "id": "y64OsZNYhp0",
   "statistics": {
    "viewCount": "1452334",
    "likeCount": "11181",
    "dislikeCount": "136",
    "favoriteCount": "0",
    "commentCount": "1865"
   }
  }
 ]
}

To get the watch time or duration of the video, include the contentDetails as your part to get the duration.

Here is the sample request for that.

https://developers.google.com/apis-explorer/#p/youtube/v3/youtube.videos.list?part=contentDetails%252Cstatistics&id=y64OsZNYhp0&_h=10&

Upvotes: 1

cbg
cbg

Reputation: 23

You can see limited statistics of videos on YouTube that aren't owned by you. To do this, click on the 'More' link underneath a video title and click 'Statistics.

enter image description here

Upvotes: 0

Related Questions