Andrew Tomash
Andrew Tomash

Reputation: 365

Inconsistent and invalid response from YouTube Data API's PlaylistItems.list

I have sent the following request to get the playlist ID of the IGN channel:

https://developers.google.com/youtube/v3/docs/channels/list?apix=true&apix_params=%7B%22part%22%3A%5B%22contentDetails%22%5D%2C%22forUsername%22%3A%22ign%22%7D#try-it.

Then I extracted contentDetails.relatedPlaylists.uploads, which is the main playlist ID of this channel.

Afterwards I used this playlist id in the following request to get corresponding videos:

https://developers.google.com/youtube/v3/docs/playlistItems/list?apix_params=%7B%22part%22%3A%5B%22contentDetails%22%2C%22snippet%22%2C%22id%22%2C%22status%22%5D%2C%22maxResults%22%3A50%2C%22playlistId%22%3A%22UU5YfR2K_rXeIy7bseOKky6Q%22%2C%22prettyPrint%22%3Atrue%7D#try-it.

The problems are:

  1. Inconsistent response (sometimes 404, sometimes 200) on same request;
  2. When I get 200, no videos were returned.

What I am doing wrong here?

Upvotes: 3

Views: 287

Answers (1)

analog-nico
analog-nico

Reputation: 2780

The behavior of the playlistItems API endpoint has changed recently.

It started to return a 404 for upload playlists of many channels that have no uploaded videos. I reported this to Google and they decided to add this change to their API documentation without changing the API itself.

This means we now have to assume that if we get a 404 for an upload playlist then the associated channel has no uploaded videos.

However, I also found a case in which the playlistItems API endpoint returns a 404 for a channel that does indeed have uploaded videos. I just reported this issue as well and am waiting for their response.

@OP: The upload playlist id that you provided is one that returns a 404 for a channel that has no uploaded videos. So that exactly matches what I just described. However, this may not fully cover your listed problems but I can tell that you use the right API requests.

The additional problems that you listed – which seem to originate from upload playlists that you did not report here – may be worth reporting as an issue to Google. Just follow the links above to find out where you can submit an issue. One piece of advice: You must provide the necessary information that allows the Google employees to reproduce your issue with 100% certainty. Otherwise they will mark your issue as "Won't Fix (not reproducible)".

Upvotes: 3

Related Questions