I came across the API reference document regarding the Search API:
Note: Search results are constrained to a maximum of 500 videos if your request specifies a value for the
channelIdparameter and sets thetypeparameter value tovideo, [...].
Do I have to apply for paid account to break the 500 videos limit? If yes, how do I apply?
If you need to obtain the list of all videos of a given channel -- identified by its ID, say
CHANNEL_ID--, then you have to proceed as follows:Step 1: Query the
Channels.listAPI endpoint with parameterid=CHANNEL_IDfor to obtain from the API the ID of that channel's uploads playlist:The code above should run only once for obtaining the uploads playlist ID as
uploads_id, then that ID should be used as many times as needed.Usually, a channel ID and its corresponding uploads playlist ID are related by
s/^UC([0-9a-zA-Z_-]{22})$/UU\1/.Step 2: Using the previously obtained uploads playlist ID -- let's name it
UPLOADS_ID--, query thePlaylistItems.listAPI endpoint for to obtain the list of all video ID's of that playlist:Upon running the code above, the list
videoswill contain the IDs of all videos that were uploaded on the channel identified byCHANNEL_ID.Step 3: Query the
Videos.listAPI endpoint for to obtain thestatisticsinfo (i.e. object) of each of the videos you're interested in:Note that code above, in case the list
videoshas lengthN, reduces the number of calls toVideos.listfromNtomath.floor(N / 50) + (1 if N % 50 else 0). That's because the parameteridofVideos.listendpoint can be specified as a comma-separated list of video IDs (the number of IDs in one such list can be maximum 50).Note also that each piece of code above uses the
fieldsrequest parameter for to obtain from the invoked API endpoints only the info that is of actual use.I must also mention that according to YouTube's staff, there's an upper 20000 limit set by design for the number of items returned via
PlaylistItems.listendpoint. This is unfortunate, but a fact.