2
votes

Currently I'm using this in order to get a list of videoIDs from a given channel:

GET https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&channelId=CHANNEL_ID&type=video&maxResults=50&key=API_KEY

This works, however the channel I want to get the videos from has a lot more than 50 Videos online. I already looked at this issue YouTube API to fetch all videos on a channel but every solution again online fetches 50 Videos max.

How can I get every video and not just 50?

2
no, every solution there only lists 50 vids, againThomas Beyer
Did you set the maxResults params to be greater than number of videos in your channel? and have used the upload id as channel id in request?Naresh Kumar

2 Answers

3
votes

So I got a solution:

(1) First, I use https://www.googleapis.com/youtube/v3/channels?id=CHANNEL_ID&key=API_KEY&part=contentDetails to get the id of the Uploads Playlist.

(2) By using https://www.googleapis.com/youtube/v3/playlistItems?playlistId=UPLOAD_ID&key=API_KEY&part=snippet&maxResults=50 I get the first 50 results and a pageToken.

(3) With the token I can collect the IDs from the next pages: https://www.googleapis.com/youtube/v3/playlistItems?playlistId=UPLOAD_ID&key=API_KEY&part=snippet&pageToken=PAGE_TOKEN&maxResults=50

(4) By using a recursive method, I can use the next Token I get from (3) to scan the next page.

0
votes

Here's a video from the YouTube Developers channel that really helped me with this: https://youtu.be/RjUlmco7v2M. It's directed towards people migrating from v2 to v3 (which I wasn't), but I kept watching and learned quite a few things.