3

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?

stvar
  • 6,551
  • 2
  • 13
  • 28
Andrew Tomash
  • 345
  • 3
  • 7
  • I confirm the same behavior described by the OP. When the API responds with HTTP status code `400`, the JSON error response looks like the following: `{"error":{"code":404,"message":"The playlist identified with the request's playlistId parameter cannot be found.","errors":[{"message":"The playlist identified with the request's playlistId parameter cannot be found.","domain":"youtube.playlistItem","reason":"playlistNotFound","location":"playlistId","locationType":"parameter"}]}}`. – stvar Dec 13 '20 at 23:58
  • When the HTTP status code is `200`, the JSON response has an empty `items` array: `{"kind":"youtube#playlistItemListResponse","etag":"...","items":[],"pageInfo":{"totalResults":0,"resultsPerPage":50}}`. – stvar Dec 13 '20 at 23:58
  • 1
    Also note that the YouTube's Web UI shows the [Ign](https://www.youtube.com/user/Ign) channel to have no content (no uploaded videos). – stvar Dec 14 '20 at 00:01
  • 1
    I'd recommend to report this issue to Google directly through its [own issue tracker site](http://issuetracker.google.com/). – stvar Dec 14 '20 at 00:03
  • @stvar , it looks like it is my mistake, I though that i am looking for this channel https://www.youtube.com/c/IGN. In any case it should return consistent response. – Andrew Tomash Dec 14 '20 at 00:08
  • Even if by mistake, in my opinion, you revealed an API bug. – stvar Dec 14 '20 at 00:09
  • [My public script](https://gist.github.com/stvar/f57e9792c3dc49fab2690247d6ee74de), for your *custom URL* `IGN`, produces `UCKy1dAqELo0zrOtPkf0eTMw`. – stvar Dec 14 '20 at 00:11
  • 1
    See [one of my answers](https://stackoverflow.com/a/64302234/8327971) w.r.t. to the difference between `forUsername` and *custom URLs*. – stvar Dec 14 '20 at 00:13
  • worked fine, when I used UUKy1dAqELo0zrOtPkf0eTMw, thanks – Andrew Tomash Dec 14 '20 at 00:19
  • 2
    I have the same issue. The 404 portion of it is reported here: https://issuetracker.google.com/issues/174471495 I am in the process of finding a way to make it reproducible for the Google folks. And I am preparing to report the 200 but empty list part. – analog-nico Dec 17 '20 at 00:52
  • Yeah, this is a bug on there side and it only started recently – xokocodo Dec 17 '20 at 01:41
  • 1
    @analog-nico please, consider post your comment as an answer. Thank you. – Mauricio Arias Olave Dec 25 '20 at 19:01

1 Answers1

3

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

analog-nico
  • 2,750
  • 17
  • 25