Stack Overflow Asked by D_Carroll on November 15, 2021
I am using YouTube Data API v3 – and today playlistItems:List only returns max of 100 data items or 2 pages of data for the all videos playlist (UU + last 22 char of channel id) . I believe the next page token also may be incorrect after the first page, because it shows the wrong previous page token on the third page.
UPDATE: Further testing shows that the playlistItems:List api works correctly
for some channels -
All video playlist - UU4mLlRa_dezwvytudo9s1sw works
https://developers.google.com/youtube/v3/docs/playlistItems/list?apix=true&apix_params=%7B%22part%22%3A%5B%22id%2Csnippet%22%5D%2C%22maxResults%22%3A50%2C%22playlistId%22%3A%22UU4mLlRa_dezwvytudo9s1sw%22%7D
but at least two others do not work correctly and only return 100 items:
UUGGZ_POGmIWG1pQXTDzQv-g
UUwD4x63A9KC7Si2RuSfg-SA
This has been working correctly for several years. It worked correctly July 16. The same behavior happens in the API Explorer.
API Explorer example & results for all video playlist UUwD4x63A9KC7Si2RuSfg-SA:
https://developers.google.com/youtube/v3/docs/playlistItems/list?apix=true&apix_params=%7B%22part%22%3A%5B%22id%2Csnippet%22%5D%2C%22maxResults%22%3A50%2C%22pageToken%22%3A%22CDIQAA%22%2C%22playlistId%22%3A%22UUwD4x63A9KC7Si2RuSfg-SA%22%7D
first page of results:
{
"kind": "youtube#playlistItemListResponse",
"etag": "oE9yCl2NBCpgzQbX82RR1jjqkco",
"nextPageToken": "CDIQAA",
"items": [
second page - page token CDIQAA:
{
"kind": "youtube#playlistItemListResponse",
"etag": "w8PJ0yDadTWJfwSP2CWcODoMzuk",
"nextPageToken": "CGQQAA",
"prevPageToken": "CDIQAQ",
"items": [
third page - page token CGQQAA:
{
"kind": "youtube#playlistItemListResponse",
"etag": "AQSyYYKWgu50RiGPA10TjRTE7Ys",
"nextPageToken": "CJYBEAA",
"prevPageToken": "CGQQAQ",
"items": [], <---- NO DATA, but 521 items still to show
"pageInfo": {
"totalResults": 621,
"resultsPerPage": 50
}
}
POSSIBLE WORKAROUNDS
Use YouTube Data API v3 – search:List specifying channel ID, no query, and result filter type = videos. This is expensive in quota, it costs 100 quota per query/page of 50 results. However, this API now seems to max out at about 300 or so results for a channel.
Use YouTube Data API v3 – playlistItems:List with a channel-owner authorized OAuth token instead of the public API key. This works as before without the 100 item limit. However, it means you cannot get a video list (over 100 videos) for a channel or a playlist without an OAuth token from the owner.
This is a known bug in the YouTube API. Public acknowledgement and tracking of the bug is here: https://issuetracker.google.com/issues/161628022
There are some duplicates, too. I found
Probably best to just wait for it to be fixed. It has only been open/assigned for a day or so, so it might get fixed quickly. Then again, it might not. It has happened before and taken a long time to fix.
Heuristically, it looks to me like this is a limitation on Unlisted Playlists, which is to say Playlists not returned by playlists.list
given the channelId
.
I checked and confirmed that even when using smaller page sizes, only the first 100 playlist items are returned for unlisted playlists (I only looked at "uploads" playlists as I do not have a lot of big unlisted playlists handy), and using page size of 50, listed playlists will return all the items (playlist PLC474234E124B5213
returns all 102 items, playlist FLSC1HqVmTaE4Shn32ihbC7w
returns all 136 items). In my experience, there are rarely workarounds for these kinds of bugs in the YouTube API. It is not worth spending a lot of time on. Live with the limit for now, document (to whoever cares) that it is a known bug/limitation, and move on as if it is a documented limitation with a pending feature request to remove the limitation.
Answered by Old Pro on November 15, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP