Closed fgl27 closed 1 year ago
Calling
https://api.twitch.tv/kraken/clips/top?limit=100&period=day&language=en
I got 95 clips, and the cursor of MTAw
which is not a valid cursor, so you can do a count of the returned clips, if you get <limit then ignore the cursor returned. (Yes agreeing bug, but thats a workaround, no need to bother with the cursor if you already on the last page), just thought I'd add that note until Twitch does something about cursors
MTAw is a valid cursor, and a 95 result when requesting 100 doesn't means that "clips have ended", as one can add the a tag "game=" to same api and the cursor works and the first cursor is MTAw, also the api doesn't return 100 when 100 is requested when a game is used.
example GTA 5
curl -s \
-H "Accept: application/vnd.twitchtv.v5+json" \
-H "Client-ID: yours_app_id" \
"https://api.twitch.tv/kraken/clips/top?game=Grand%20Theft%20Auto%20V&limit=100&period=day&language=en" \
| jq -r "._cursor"
result of cursor
MTAw
Now the length
curl -s \
-H "Accept: application/vnd.twitchtv.v5+json" \
-H "Client-ID: yours_app_id" \
"https://api.twitch.tv/kraken/clips/top?game=Grand%20Theft%20Auto%20V&limit=100&period=day&language=en \
| jq ".clips | length"
result of length
87
Now using the cursor "MTAw" the length
curl -s \
-H "Accept: application/vnd.twitchtv.v5+json" \
-H "Client-ID: yours_app_id" \
"https://api.twitch.tv/kraken/clips/top?game=Grand%20Theft%20Auto%20V&limit=100&period=day&language=en&cursor=MTAw" \
| jq ".clips | length"
result of length
88
so on so on using the tag game
I can get a list of about 1000 clips, requesting 100 doesn't returns 100 so another issue, but adding a game shows that there is clips available for the period=day
and language=en
, this shows that adding a game to the same api makes it work, so the normal use of the api must also work after all clips are there is not showing because the server is somehow malfunctioning.
But I must note that even when a game is added sometimes I see the 500 error.
The issue of "not returning the quested limit
when the limit is not yet reached" is not what I wanna to work on this issue, I wanna to resolve the problem of the status 500.
As that limit issue doesn't affect my use as I account for it as this is not the only api that does this, so in a way I'm used to it, but if you guys wanna to work on it is a plus.
I've also experienced this issue but it's sporadic. I'm requesting 10 clips at a time.
Loading 10 at a time I manage to load 150 clips before getting error 500.
But that is not close to the quantity of clips available as when I load a game I can go up to 1000 in a few games, and 10 at a time is waste of time, as 10 internet request will take more time then a single request for 100 clips.
oddly replacing the language en
with en,en-gb
"fixes" the problem at least for english other language still produce the error, I only started having this issue and using only en
after https://github.com/twitchdev/issues/issues/66 but still today the documentation for the clip API has:
language | string | Comma-separated list of languages, which constrains the languages of videos returned. Examples: es, en,es,th. If no language is specified, all languages are returned. Default: "". Maximum: 28 languages.
I guess Twitch doesn't care for this problem at all, maybe that's how it always worked the error was always there no one notice before or if notice didn't care, after all I first inform this back in February and they never even acknowledge it as a issue yet.
Anyway here is a workaround for en
language... other languages that have multiple options are es,es-mx
and pt,pt-br
.
Closing since v5 is no longer available.
Brief description As informed on issue https://github.com/twitchdev/issues/issues/66 This api is not working properly since above issue was open.
After loading a page of 100 clips, one can't request more clips using the "cursor" when a language is set.
How to reproduce Load the first "page" and filter just the cursor
Result
MTAw
Now use the cursor
Result
null
Try again without the
jq
filter to see the error:Result
Expected behavior The proper API result, that when no more content exist return a cursor="" or a empty cursor meaning last page was reached, any subsequent request just cause the api to return repetitive result starting again from top.
Screenshots Doesn't applies.
Additional context or questions Doesn't applies.