PlaylistItems seems to be limited to 20 000 entires for uploads playlist. Is there any workaround?

前端 未结 1 1444
心在旅途
心在旅途 2021-01-24 02:38

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 UCFL

相关标签:
1条回答
  • 2021-01-24 03:24

    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).

    0 讨论(0)
提交回复
热议问题