PlaylistItems list query - empty response when nextPageToken is CGQQAA

558 views
Skip to first unread message

Nelu Lazar

unread,
Mar 18, 2014, 11:11:24 PM3/18/14
to google-api-obj...@googlegroups.com
Today PlaylistItems list query stopped loading next pages, particularly when nextPageToken was equal to "CGQQAA". I tried maxResults 20, then 50, it did not matter, it seems that when nextPageToken is "CGQQAA" the response is always this one below, and I can't retrieve more than 100 items in a playlist:

Query:

query = [GTLQueryYouTube queryForPlaylistItemsListWithPart:@"snippet,contentDetails"];


Response:

{

  "nextPageToken" : "CHgQAA",

  "etag" : "\"-8paSN4aHyZW-_dh69lsm897sXc\/E0aDlu_SkMMmvH5-c_yQEj-Ji-4\"",

  "pageInfo" : {

    "totalResults" : 199,

    "resultsPerPage" : 20

  },

  "kind" : "youtube#playlistItemListResponse",

  "prevPageToken" : "CGQQAQ"

}

Greg Robbins

unread,
Mar 19, 2014, 6:09:39 PM3/19/14
to google-api-obj...@googlegroups.com
The Get Help section of https://developers.google.com/youtube/ has links for questions about use of the YouTube API.

Since most YouTube engineers are not familiar with Objective-C, use the library's http logging feature to get a log of the relevant server requests & responses.


Nelu Lazar

unread,
Mar 19, 2014, 7:10:33 PM3/19/14
to google-api-obj...@googlegroups.com
Greg,

Thank you for your suggestions. I posted this because I believe it's a recent bug in the library. Without me changing my previous code (that worked very well for the past months and loaded all videos in a playlist), the API just stopped working these past days. I tried the Google API "Try it!" tool here but it acts the same as my script and returns the same empty results.

Below are the GTMHTTPFetcher ticket logs, during an attempt to load a public playlist of 171 videos:
  1. GTLQuery asks for the first 50 videos of playlist PLbpi6ZahtOH6ABXapjA_NoPqYQZxvbX-i
  2. YouTube API returns 50 videos (1-50)
  3. GTLQuery asks for next 50 videos of the playlist
  4. YouTube API returns 50 videos (51-100)
  5. GTLQuery asks for next 50 videos of the playlist
  6. GTLQuery returns empty result for videos 101-150
  7. GTLQuery asks for next 50 videos of the playlist
  8. GTLQuery returns empty result for videos 151-171
This happens with all the playlists that I attempt to load. Can you please advise? Thanks!


FULL LOG:

2014-03-19 18:43:34.659 AppName[46348:70b] youtube.playlistItems.list

2014-03-19 22:43:34 +0000
Request headers:
  Accept: application/json-rpc
  Authorization: Bearer _snip_
  Cache-Control: no-cache
  Content-Type: application/json-rpc; charset=utf-8
  User-Agent: AppAgent google-api-objc-client/2.0 iPhone_Simulator/7.0.3 (gzip)

Request body: (196 bytes)
{
  "method" : "youtube.playlistItems.list",
  "id" : "gtl_37",
  "jsonrpc" : "2.0",
  "params" : {
    "playlistId" : "PLbpi6ZahtOH6ABXapjA_NoPqYQZxvbX-i",
    "maxResults" : 50,
    "part" : "snippet,contentDetails"
  },
  "apiVersion" : "v3"
}

Response: status 200
Response headers:
  Alternate-Protocol: 443:quic
  Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  Content-Encoding: gzip
  Content-Length: 20610
  Content-Type: application/json; charset=UTF-8
  Date: Wed, 19 Mar 2014 22:43:30 GMT
  Expires: Fri, 01 Jan 1990 00:00:00 GMT
  Pragma: no-cache
  Server: GSE
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-XSS-Protection: 1; mode=block

Response body: (80025 bytes)
{
  "id" : "gtl_37",
  "result" : {
    "nextPageToken" : "CDIQAA",
    "etag" : "\"-8paSN4aHyZW-_dh69lsm897sXc\/KluM-ioPb-NZIopdJv0nnA1AlHM\"",
    "pageInfo" : {
      "totalResults" : 171,
      "resultsPerPage" : 50
    },
    "kind" : "youtube#playlistItemListResponse",
    "items" : [
      {
        "snippet" : {
          "publishedAt" : "2014-03-19T18:37:01.000Z",
          "position" : 0,
          "channelTitle" : "YouTube Spotlight",
          "playlistId" : "PLbpi6ZahtOH6ABXapjA_NoPqYQZxvbX-i",
          "channelId" : "UCBR8-60-B28hp2BmDPdntcQ",
          "resourceId" : {
            "kind" : "youtube#video",
            "videoId" : "xksxl_eh3-g"
          },
          "title" : "Neneh Cherry feat. Robyn - \"Out Of The Black\" (Official Video)"
        },
        "etag" : "\"-8paSN4aHyZW-_dh69lsm897sXc\/xs30VuXEEKkIFT17ODBYit56uGQ\"",
        "id" : "PLtQjJq7p7MAJRYW_OEql1CKgxc2t5ir2KFz8tEeNJFLQ",
        "contentDetails" : {
          "videoId" : "xksxl_eh3-g"
        },
        "kind" : "youtube#playlistItem"
      },
      AND 49 MORE VIDEOS DATA...
    ]
  }
}

2014-03-19 18:43:46.742 AppName[46348:70b] youtube.playlistItems.list

2014-03-19 22:43:46 +0000
Request headers:
  Accept: application/json-rpc
  Authorization: Bearer _snip_
  Cache-Control: no-cache
  Content-Type: application/json-rpc; charset=utf-8
  User-Agent: AppAgent google-api-objc-client/2.0 iPhone_Simulator/7.0.3 (gzip)

Request body: (217 bytes)
{
  "method" : "youtube.playlistItems.list",
  "id" : "gtl_39",
  "jsonrpc" : "2.0",
  "params" : {
    "part" : "snippet,contentDetails",
    "playlistId" : "PLbpi6ZahtOH6ABXapjA_NoPqYQZxvbX-i",
    "maxResults" : 50,
    "pageToken" : "CDIQAA"
  },
  "apiVersion" : "v3"
}

Response: status 200
Response headers:
  Alternate-Protocol: 443:quic
  Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  Content-Encoding: gzip
  Content-Length: 20541
  Content-Type: application/json; charset=UTF-8
  Date: Wed, 19 Mar 2014 22:43:40 GMT
  Expires: Fri, 01 Jan 1990 00:00:00 GMT
  Pragma: no-cache
  Server: GSE
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-XSS-Protection: 1; mode=block

Response body: (84160 bytes)
{
  "id" : "gtl_39",
  "result" : {
    "nextPageToken" : "CGQQAA",
    "etag" : "\"-8paSN4aHyZW-_dh69lsm897sXc\/x2kmkxWpRk6jF0qj7EgTXF6eNSU\"",
    "pageInfo" : {
      "totalResults" : 171,
      "resultsPerPage" : 50
    },
    "items" : [
      {
        "snippet" : {
          "publishedAt" : "2013-12-30T17:36:10.000Z",
          "position" : 80,
          "channelTitle" : "YouTube Spotlight",
          "playlistId" : "PLbpi6ZahtOH6ABXapjA_NoPqYQZxvbX-i",
          "channelId" : "UCBR8-60-B28hp2BmDPdntcQ",
          "resourceId" : {
            "kind" : "youtube#video",
            "videoId" : "jGjdZX-pK7s"
          },
          "title" : "'Ordinary Love' - New Video by Oliver Jeffers & Mac Premo"
        },
        "etag" : "\"-8paSN4aHyZW-_dh69lsm897sXc\/M90F30UPqilvuzD9QUjsZ911ytk\"",
        "id" : "PLtQjJq7p7MAJRYW_OEql1CK2aWccHouc6D0P8daY89G0",
        "contentDetails" : {
          "videoId" : "jGjdZX-pK7s"
        },
        "kind" : "youtube#playlistItem"
      },
      AND 49 MORE VIDEOS DATA...
    ],
    "kind" : "youtube#playlistItemListResponse",
    "prevPageToken" : "CDIQAQ"
  }
}

2014-03-19 18:43:56.089 AppName[46348:70b] youtube.playlistItems.list

2014-03-19 22:43:56 +0000
Request headers:
  Accept: application/json-rpc
  Authorization: Bearer _snip_
  Cache-Control: no-cache
  Content-Type: application/json-rpc; charset=utf-8
  User-Agent: AppAgent google-api-objc-client/2.0 iPhone_Simulator/7.0.3 (gzip)

Request body: (217 bytes)
{
  "method" : "youtube.playlistItems.list",
  "id" : "gtl_41",
  "jsonrpc" : "2.0",
  "params" : {
    "part" : "snippet,contentDetails",
    "playlistId" : "PLbpi6ZahtOH6ABXapjA_NoPqYQZxvbX-i",
    "maxResults" : 50,
    "pageToken" : "CGQQAA"
  },
  "apiVersion" : "v3"
}

Response: status 200
Response headers:
  Alternate-Protocol: 443:quic
  Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  Content-Encoding: gzip
  Content-Length: 214
  Content-Type: application/json; charset=UTF-8
  Date: Wed, 19 Mar 2014 22:43:53 GMT
  Expires: Fri, 01 Jan 1990 00:00:00 GMT
  Pragma: no-cache
  Server: GSE
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-XSS-Protection: 1; mode=block

Response body: (240 bytes)
{
  "id" : "gtl_41",
  "result" : {
    "nextPageToken" : "CJYBEAA",
    "etag" : "\"-8paSN4aHyZW-_dh69lsm897sXc\/faOT78tD_OD_wfWBXjyLkOKA0fE\"",
    "pageInfo" : {
      "totalResults" : 171,
      "resultsPerPage" : 50
    },
    "kind" : "youtube#playlistItemListResponse",
    "prevPageToken" : "CGQQAQ"
  }
}

2014-03-19 18:44:00.941 AppName[46348:70b] youtube.playlistItems.list

2014-03-19 22:44:00 +0000
Request headers:
  Accept: application/json-rpc
  Authorization: Bearer _snip_
  Cache-Control: no-cache
  Content-Type: application/json-rpc; charset=utf-8
  User-Agent: AppAgent google-api-objc-client/2.0 iPhone_Simulator/7.0.3 (gzip)

Request body: (218 bytes)
{
  "method" : "youtube.playlistItems.list",
  "id" : "gtl_43",
  "jsonrpc" : "2.0",
  "params" : {
    "part" : "snippet,contentDetails",
    "playlistId" : "PLbpi6ZahtOH6ABXapjA_NoPqYQZxvbX-i",
    "maxResults" : 50,
    "pageToken" : "CJYBEAA"
  },
  "apiVersion" : "v3"
}

Response: status 200
Response headers:
  Alternate-Protocol: 443:quic
  Cache-Control: no-cache, no-store, max-age=0, must-revalidate
  Content-Encoding: gzip
  Content-Length: 199
  Content-Type: application/json; charset=UTF-8
  Date: Wed, 19 Mar 2014 22:43:58 GMT
  Expires: Fri, 01 Jan 1990 00:00:00 GMT
  Pragma: no-cache
  Server: GSE
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-XSS-Protection: 1; mode=block

Response body: (215 bytes)
{
  "id" : "gtl_43",
  "result" : {
    "pageInfo" : {
      "totalResults" : 171,
      "resultsPerPage" : 50
    },
    "etag" : "\"-8paSN4aHyZW-_dh69lsm897sXc\/HBmr6orNJR1amI-HyOLWDjIhctQ\"",
    "kind" : "youtube#playlistItemListResponse",
    "prevPageToken" : "CJYBEAE"
  }
}

Greg Robbins

unread,
Mar 19, 2014, 7:51:25 PM3/19/14
to google-api-obj...@googlegroups.com
The Objective-C library has not changed lately in a way that would affect these requests. The change log for the client library is at https://code.google.com/p/google-api-objectivec-client/source/list

The YouTube API engineers will be able to determine if a problem has cropped up with a recent release of the API on the servers. Those engineers follow the YouTube API help areas at <https://developers.google.com/youtube/>, not the Objective-C client library discussions.

Nelu Lazar

unread,
Mar 20, 2014, 2:41:21 PM3/20/14
to google-api-obj...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages