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

V5 clip api returns status 500 "Internal Server Error" #122

Closed
fgl27 opened this issue May 28, 2020 · 7 comments
Closed

V5 clip api returns status 500 "Internal Server Error" #122

fgl27 opened this issue May 28, 2020 · 7 comments
Labels
product: v5 API endpoints in the "v5" namespace stopped investigating An issue that cannot be reproduced and is no longer being actively investigated.

Comments

@fgl27
Copy link

fgl27 commented May 28, 2020

Brief description
As informed on issue #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

curl -s \
  -H "Accept: application/vnd.twitchtv.v5+json" \
  -H "Client-ID: yours_app_id" \
  "https://api.twitch.tv/kraken/clips/top?limit=100&period=day&language=en" \
  | jq -r "._cursor"

Result
MTAw

Now use the cursor

curl -s \
  -H "Accept: application/vnd.twitchtv.v5+json" \
  -H "Client-ID: yours_app_id" \
  "https://api.twitch.tv/kraken/clips/top?limit=100&period=day&cursor=MTAw&language=en" \
  | jq -r "._cursor"

Result

null

Try again without the jq filter to see the error:

curl -s \
  -H "Accept: application/vnd.twitchtv.v5+json" \
  -H "Client-ID: yours_app_id" \
  "https://api.twitch.tv/kraken/clips/top?limit=100&period=day&cursor=MTAw&language=en"

Result

{
  "error": "Internal Server Error",
  "status": 500,
  "message": ""
}

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.

@fgl27 fgl27 added the product: v5 API endpoints in the "v5" namespace label May 28, 2020
@BarryCarlyon
Copy link
Contributor

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

@fgl27
Copy link
Author

fgl27 commented May 28, 2020

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.

@fgl27
Copy link
Author

fgl27 commented May 28, 2020

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.

@PomegranateApps
Copy link

I've also experienced this issue but it's sporadic. I'm requesting 10 clips at a time.

@fgl27
Copy link
Author

fgl27 commented Jun 1, 2020

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.

@fgl27
Copy link
Author

fgl27 commented Jul 7, 2020

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 #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.

@jbulava jbulava added the stopped investigating An issue that cannot be reproduced and is no longer being actively investigated. label Apr 18, 2023
@jbulava
Copy link
Member

jbulava commented Apr 18, 2023

Closing since v5 is no longer available.

@jbulava jbulava closed this as completed Apr 18, 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 stopped investigating An issue that cannot be reproduced and is no longer being actively investigated.
Projects
None yet
Development

No branches or pull requests

4 participants