I'm trying to use the YouTube data api v3 to get the most viewed videos for a channel. This other SO question said the best way to do this is "search->list with specifying the channelId and order = viewcount".
What I've found is this result sometimes differs from what I see by directly going to a YouTube channel.
For a specific example, I'm looking at this channel: https://www.youtube.com/user/TheGIIF/videos
It has 3 videos.
Compare that with the following request:
GET https://www.googleapis.com/youtube/v3/search?order=viewCount&part=id&channelId=UCKvRfU5Yaf8XijZPXFJfmlg&key={YOUR_API_KEY}
This returns the following json:
{
"kind": "youtube#searchListResponse",
"etag": "\"k1sYjErg4tK7WaQQxvJkW5fVrfg/xXXGtXCJVmIX8cvSbV7aTD43t0g\"",
"pageInfo": {
"totalResults": 2,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"k1sYjErg4tK7WaQQxvJkW5fVrfg/pX-Ao3RW_w2XWZZfiA3_50lj7Ks\"",
"id": {
"kind": "youtube#channel",
"channelId": "UCKvRfU5Yaf8XijZPXFJfmlg"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"k1sYjErg4tK7WaQQxvJkW5fVrfg/5uoVIdj1bFGaDCWnwAVwP1RwTyI\"",
"id": {
"kind": "youtube#video",
"videoId": "EsX40Bu84O0"
}
}
]
}
So only one available video. Why the discrepancy?
And, not sure if this is just coincidental, but if I search the channel name within the channel: https://www.youtube.com/user/TheGIIF/search?query=thegiif
I only get back 1 video, the same video as the json response above.