1

It seems that somewhat recently uploads playlists were limited to 20 000 entries. Is there a way to get list of all videos uploaded by a channel?

For example channel UCFL1sCAksD6_7JIZwwHcwjQ has 57 849 videos when searching for it:

https://www.youtube.com/results?search_query=jtbc+entertainment.

But its uploads playlist has only 20 000 videos:

https://www.youtube.com/playlist?list=UUFL1sCAksD6_7JIZwwHcwjQ.

When querying YouTube Data API through Python, after reaching page that has 20 000th entry, nextPageToken doesn't exist.

How can I find rest of the videos?

stvar
  • 5,871
  • 2
  • 10
  • 23
user7810882
  • 193
  • 3
  • 12

1 Answers1

4

You may try using repeatedly the Search.list API endpoint queried with the following parameters:

  • channelId=UCFL1sCAksD6_7JIZwwHcwjQ,
  • type=video,
  • order=date,
  • publishedBefore=...,
  • maxResults=50,

where publishedBefore is computed appropriately.

The initial publishedBefore is set to 1 second before the value of the publishedAt property of the (chronologically) last video you have obtained from PlaylistItems.list endpoint invoked with playlistId=UUFL1sCAksD6_7JIZwwHcwjQ.

Successive values of publishedBefore will be set, similarly, to 1 second before the value of the publishedAt property of the (chronologically) last video of the previous call to Search.list endpoint.

One more remark: do note that -- even if the API will allow you to go beyond the 20000 limit using the algorithm above (I don't know if it will; you have to test that yourself) -- the cost of this procedure is quite high: each Search.list endpoint call has a quota cost of 100 units (expensive indeed).

stvar
  • 5,871
  • 2
  • 10
  • 23
  • Results from that endpoint don't include all matching videos. For example, searching with publishedBefore= '2013-09-20T02:57:56Z' returns videos, with published dates from 2013-09-19 to 2013-08-24 but the result doesn't include video DkIo-wbRJz4, which has been published 2013-09-16, which fits the returned range. – user7810882 Aug 21 '20 at 15:52
  • Indeed that's one of peculiarities of `Search.list` endpoint: it is not precise at all, but has a very fuzzy behavior. I can confirm that from my own experience; but I have no knowledge of anything official (from Google or YouTube) that might confirm this observed behavior. From the perspective of an API user, unfortunately, `Search.list` is entirely opaque. – stvar Aug 21 '20 at 16:03
  • Even if `Search.list` is fuzzy, from your point of view, it may still worth using this endpoint for to obtain from the API as much video IDs as you can, beyond that 20000 limit. – stvar Aug 21 '20 at 16:04