I want to get number of comments and/or likes for video with specific YouTube ID. I am using YouTube API v3.0.
I was searching through API documentation and can't find appropriate method.
I want to get number of comments and/or likes for video with specific YouTube ID. I am using YouTube API v3.0.
I was searching through API documentation and can't find appropriate method.
If you want number of comments and/or likes for video with specific YouTube ID, you need to use the YouTube API V3 with youtube.videos.list
with the parameters :
part=id, statistics
id=VIDEO_ID
This is the output :
"items": [
{
"kind": "youtube#video",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/-hharrXKffaZ3z4sIleW9K-Nf2Q\"",
"id": "_RtGuUAQOC4",
"statistics": {
"viewCount": "484851",
"likeCount": "3993",
"dislikeCount": "72",
"favoriteCount": "0",
"commentCount": "262"
}
}
]
LIVE DEMO
You can find all informations about video list in the doc :https://developers.google.com/youtube/v3/docs/videos/list?hl=fr :
After having better look at Google API documentation here, I have found that I can use "statistics" part parameter of Videos.List API in order to get what I want.
Exact HTTP post request should be (notice part=statistics parameter):
GET https://www.googleapis.com/youtube/v3/videos?part=statistics&id=sTPtBvcYkO8&key={YOUR_API_KEY}
And response is:
{
"kind": "youtube#videoListResponse",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/XN5YXMZGQaruwTWTekZu7fQthdY\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/QbzZs_aBNpzkZJxTVM7YgQeEY3g\"",
"id": "sTPtBvcYkO8",
"statistics": {
"viewCount": "3215321",
"likeCount": "17003",
"dislikeCount": "263",
"favoriteCount": "0",
"commentCount": "621"
}
}
]
}