Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offset parameter ignore for kraken/users/follows #237

Closed
mikechambers opened this issue Oct 2, 2020 · 11 comments
Closed

Offset parameter ignore for kraken/users/follows #237

mikechambers opened this issue Oct 2, 2020 · 11 comments
Labels
product: v5 API endpoints in the "v5" namespace ticketed Has been given an internal tracking ticket

Comments

@mikechambers
Copy link

mikechambers commented Oct 2, 2020

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

@mikechambers mikechambers added the product: v5 API endpoints in the "v5" namespace label Oct 2, 2020
@lleadbet lleadbet added the ticketed Has been given an internal tracking ticket label Oct 2, 2020
@lleadbet
Copy link
Contributor

lleadbet commented Oct 2, 2020

@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
Copy link
Author

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

joaopsys pushed a commit to joaopsys/NowStreaming-Firefox that referenced this issue Oct 8, 2020
  Remember last sorting method and sorting order
  Hotfix sync/import from twitch due to a twitch API bug reported in twitchdev/issues#237
joaopsys pushed a commit to joaopsys/NowStreaming that referenced this issue Oct 8, 2020
  Remember last sorting method and sorting order
  Hotfix sync/import from twitch due to a twitch API bug reported in twitchdev/issues#237
joaopsys added a commit to joaopsys/NowStreaming that referenced this issue Oct 8, 2020
  Remember last sorting method and sorting order
  Hotfix sync/import from twitch due to a twitch API bug reported in twitchdev/issues#237
joaopsys added a commit to joaopsys/NowStreaming-Firefox that referenced this issue Oct 8, 2020
  Remember last sorting method and sorting order
  Hotfix sync/import from twitch due to a twitch API bug reported in twitchdev/issues#237
joaopsys added a commit to joaopsys/NowStreaming that referenced this issue Oct 8, 2020
  Remember last sorting method and sorting order
  Hotfix sync/import from twitch due to a twitch API bug reported in twitchdev/issues#237
@d-fischer
Copy link

d-fischer commented Oct 18, 2020

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
Copy link

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
Copy link
Contributor

@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
Copy link
Author

@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
Copy link
Contributor

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

@bastimeyer
Copy link

@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
Copy link

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
Copy link

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
Copy link

Xemdo commented Jul 27, 2023

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

@Xemdo Xemdo closed this as completed Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product: v5 API endpoints in the "v5" namespace ticketed Has been given an internal tracking ticket
Projects
None yet
Development

No branches or pull requests

6 participants