Reputation: 155
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
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.
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.
Upvotes: 1
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.
Upvotes: 0