twitchdev / issues

Issue tracker for third party developers.
Apache License 2.0
73 stars 6 forks source link

Offset parameter ignore for kraken/users/follows #237

Closed mikechambers closed 1 year ago

mikechambers commented 4 years ago

Brief description

When using: https://dev.twitch.tv/docs/v5/reference/users#get-user-follows

The offset value is being ignored, making it impossible to load all data (above 100).

Example call: https://api.twitch.tv/kraken/users/43091333/follows/channels?limit=100&offset=0

Returns first 100 items, with a _total of 382.

If you then increment the offset: https://api.twitch.tv/kraken/users/43091333/follows/channels?limit=100&offset=100

The same data set is returned.

I started getting reports about this about two days ago, and it appears to only impact some users. In my case, I was not using Oauth for authentication, but rather passing in user id via URL and setting the Accept header : application/vnd.twitchtv.v5+json.

There are a number of other reports on the Twitch Developer discord, included below:

CommanderRootToday at 7:23 AM https://discord.com/channels/504015559252377601/523675960797691915/761131559528693761 I just checked the following API (https://api.twitch.tv/kraken/users/{userID}/follows/channels?limit=100&direction=desc&sortby=created_at&offset=0) and the offset seems to be completly ignored on that one. You get the first 100 and if there are more you're out of luck getting them. You can try it with this for example this to see the effect https://twitch-tools.rootonline.de/followinglist_viewer.php DistToday at 7:25 AM

It's not just an offset issue. For example https://api.twitch.tv/kraken/users/19264788/follows/channels, which is Nightbot, and follows 93 users, only returns a single follow regardless of offset (or lack thereof). Using Helix on the other hand returns all 93 follows without issue.

Offset value is being ignored for some users (I know there is now a limit to 900, but its ignore for all values (again, just for some users, and just since last night).

https://api.twitch.tv/kraken/users/43091333/follows/channels?limit=100&offset=200

How to reproduce

Expected behavior

Offset value increments data being returned

Screenshots

Additional context or questions

lleadbet commented 4 years ago

@mikechambers - thanks for filing this! We're taking a look at it in ticket VXL-1637, however in the meantime the other sorts beyond created_at (the default) will work with the offset normally.

mikechambers commented 4 years ago

thanks for filing this! We're taking a look at it in ticket VXL-1637, however in the meantime the other sorts beyond created_at (the default) will work with the offset normally.

@lleadbet Thank you. Can confirm that works:

https://api.twitch.tv/kraken/users/21368682/follows/channels?limit=100&offset=100&sortby=last_broadcast

d-fischer commented 4 years ago

Worth noting that kraken/channels/<ID>/follows is also affected by this, and since it doesn't have a sortby parameter, possibly has no workaround.

bastimeyer commented 3 years ago

Yep, broken and offset gets ignored. The lack of responses on this issue tracker from the responsible Twitch devs is concerning, even if v5 is deprecated. This is at least the third or fourth pagination issues I've encountered over the past year.

Example (without posting explicit user and channel IDs):

$ curl -s \
  -H "Accept: application/vnd.twitchtv.v5+json" \
  -H "Client-ID: CLIENT_ID" \
  -H "Authorization: OAuth TOKEN" \
  "https://api.twitch.tv/kraken/users/USER_ID/follows/channels" \
  | jq '._total'
140
$ curl -s \
  -H "Accept: application/vnd.twitchtv.v5+json" \
  -H "Client-ID: CLIENT_ID" \
  -H "Authorization: OAuth TOKEN" \
  "https://api.twitch.tv/kraken/users/USER_ID/follows/channels?limit=5&offset=0" \
  | jq '.follows[].created_at'
"2020-12-03T00:36:57Z"
"2020-09-07T20:19:11Z"
"2020-06-25T20:50:17Z"
"2020-05-24T17:53:24Z"
"2020-03-29T15:09:01Z"
$ curl -s \
  -H "Accept: application/vnd.twitchtv.v5+json" \
  -H "Client-ID: CLIENT_ID" \
  -H "Authorization: OAuth TOKEN" \
  "https://api.twitch.tv/kraken/users/USER_ID/follows/channels?limit=5&offset=5" \
  | jq '.follows[].created_at'
"2020-12-03T00:36:57Z"
"2020-09-07T20:19:11Z"
"2020-06-25T20:50:17Z"
"2020-05-24T17:53:24Z"
"2020-03-29T15:09:01Z"
lleadbet commented 3 years ago

@d-fischer @bastimeyer - Apologies for radio silence here. The team is still digging into the above ticket, however we wanted to provide a couple updates on the channels/:channel_id/follows endpoint.

As noted above, the offset parameter is no longer working, and we're planning to deprecate it as a result. In its place, you can use the cursor parameter along with the _cursor attribute in the response to get the remaining results.

If you have issues with that, please tag me directly and I'll have the team triage quickly.

Additionally- @bastimeyer, if you have specific pagination issues you're noting, please feel free to let me know and I'm happy to dig. You can ping me on Discord in the TwitchDev Discord as @ConcreteEntree.

Again- sincere apologies here.

mikechambers commented 3 years ago

@lleadbet For the original bug, the workaround was to use a sort other than the default (created_at), which then works correctly. Will this still work?

lleadbet commented 3 years ago

@mikechambers - For the users endpoint, that's correct. The above only applies to the channel follows endpoint in v5.

bastimeyer commented 3 years ago

@lleadbet

As noted above, the offset parameter is no longer working, and we're planning to deprecate it as a result. In its place, you can use the cursor parameter along with the _cursor attribute in the response to get the remaining results.

There is no _cursor field in the JSON response, so your proposed workaround is not working.

bastimeyer commented 3 years ago

Could we please get a response from one of the responsible Twitch API devs?

As I've already said a month ago, the API on the /kraken/users/ID/follows/channels endpoint doesn't return the _cursor field, so it's impossible to use the cursor query parameter here.

And the documented offset parameter is still broken.

This needs to be fixed.


no _cursor field in the JSON response

curl -s \
  -H "Accept: application/vnd.twitchtv.v5+json" \
  -H "Client-ID: MY_CLIENT_ID" \
  -H "Authorization: OAuth MY_OAUTH_TOKEN" \
  "https://api.twitch.tv/kraken/users/MY_USER_ID/follows/channels?limit=1" \
  | jq
{
  "_total": 138,
  "follows": [
    {...}
  ]
}

offset still broken

curl -s \
  -H "Accept: application/vnd.twitchtv.v5+json" \
  -H "Client-ID: MY_CLIENT_ID" \
  -H "Authorization: OAuth MY_OAUTH_TOKEN" \
  "https://api.twitch.tv/kraken/users/MY_USER_ID/follows/channels?limit=1" \
  | jq -r '.follows[0].channel._id'
419330868
curl -s \
  -H "Accept: application/vnd.twitchtv.v5+json" \
  -H "Client-ID: MY_CLIENT_ID" \
  -H "Authorization: OAuth MY_OAUTH_TOKEN" \
  "https://api.twitch.tv/kraken/users/MY_USER_ID/follows/channels?limit=1&offset=1" \
  | jq -r '.follows[0].channel._id'
419330868
curl -s \
  -H "Accept: application/vnd.twitchtv.v5+json" \
  -H "Client-ID: MY_CLIENT_ID" \
  -H "Authorization: OAuth MY_OAUTH_TOKEN" \
  "https://api.twitch.tv/kraken/users/MY_USER_ID/follows/channels?limit=1&offset=2" \
  | jq -r '.follows[0].channel._id'
419330868
AlexWayfer commented 3 years ago

It's annoying that this bug is still alive for more than a half of year, but work-around with sortby=login actually works.

Xemdo commented 1 year ago

Closing due to the deprecation of the Kraken API as of February 2023.