0
votes

I'm using the YouTube search.list API to look for all videos on a specific channel:

https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&channelId=my-channel-id&key=my-public-key

(I can't give specifics due to privacy I'm afraid.)

So this works well for common YouTube channels, but only sometimes works for certain personal ones, often returning no results.

What happens with personal ones is: the first call you make returns the videos, but if you refresh the browser it returns with no results (but no errors either).

I found these two live issues regarding inconsistent search results, but my problem seems a bit different (no query, just a specific channel ID).

Any idea what's going on? I can't find differences between the channels that return results consistently and those that don't. It's almost as if Google is throttling certain search results. The same thing happens if I'm authorised rather than using a public key.

An alternative approach to getting all of the videos in a channel (ideally in a single call) would also be acceptable.

1

1 Answers

0
votes

So to answer my own question, you can use the activities.list API to get all videos in a channel, which seems more reliable than search:

https://www.googleapis.com/youtube/v3/activities?part=snippet%2CcontentDetails&channelId=my-channel-id&key=my-public-key

You need to include the 'contentDetails' part as it contains the video ID.


Update

Another way is to use the "uploads" playlist (see this SO answer). This is better than activities, as activities include things other than video uploads, and the API doesn't provide a way to filter.

https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=my-uploads-playlist-id&key=my-public-key