I'm trying to fetch all the videos in a channel. I've noticed an inconsistency between the number of results returned by /search and /playlistItems.
When using /search
, totalResults = 20
and 20 items are returned.
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCaLCI9770qY9hGRmdZgVV-g&maxResults=50&type=video&key={YOUR_API_KEY}
However, when using /playlistItems
(using the approach here), totalResults = 23
but items contains only 20 items.
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=UUaLCI9770qY9hGRmdZgVV-g&key={YOUR_API_KEY}
The YouTube Channel currently shows 20 videos on the website: https://www.youtube.com/user/1957fenderstrat/videos
Is it possible that totalResults
in /playlistItems
is counting deleted videos?
Does anybody have a solution to getting all the videos of a channel, without incurring the higher cost of a call to /search
?
Potentially related:
youtube api playlistitems deleted videos
EDIT :
I just noticed that the channel statistics also returns a videoCount
of 23.
https://www.googleapis.com/youtube/v3/channels?part=statistics&id=UCaLCI9770qY9hGRmdZgVV-g&maxResults=50&key={YOUR_API_KEY}