twitchdev / issues

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

Kraken API: streams endpoint - "language" query string parameter is ignored #66

Closed oliverfindl closed 4 years ago

oliverfindl commented 4 years ago

Brief description: After recent (2020-02-21) changes to /streams#get-live-streams API endpoint, language query string parameter is ignored and API returns unfiltered results.


How to reproduce:

$ curl -H 'Accept: application/vnd.twitchtv.v5+json' -H 'Client-ID: CLIENT_ID' -X GET 'https://api.twitch.tv/kraken/streams/?language=ru&limit=1'

Expected behavior: Return filtered result(s) by language.


Screenshots: N/A


Additional context or questions:

jbulava commented 4 years ago

Also refer to this forum post.

It mentioned an issue with boradcaster_language as well, although undocumented/unsupported.

fgl27 commented 4 years ago

Languages works for clips but there is issues that started with this issue...

Getting a lot of 500 error when using a cursor and a language from clip api "https://api.twitch.tv/kraken/clips/top"

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

MTAw

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

MjAw

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

null

curl -s \
  -H "Accept: application/vnd.twitchtv.v5+json" \
  -H "Client-ID: the-id" \
  "https://api.twitch.tv/kraken/clips/top?limit=100&period=day&cursor=MjAw&language=en" \
  | jq
{
  "error": "Internal Server Error",
  "status": 500,
  "message": ""
}

This never happened before only started after this language bug, when a list ends or there is no more cursor to give the cursor return empty string ""

jbulava commented 4 years ago

This has been ticketed internally as VXL-822.

oliverfindl commented 4 years ago

Hello @jbulava,

it seems, that also broadcaster_language parameter stopped working tonight. It's not clear to me, how we should perform queries for streams filtered by specific language(s) now. Recent rate limiting changes of #get-live-streams endpoint made it not possible to use (ineffective) workaround based on fetching all streams and then filter out streams within our target language(s).

Switching to Helix it's not acceptable because:

It's there any ETA about fixing this issue?

Thanks

fgl27 commented 4 years ago

the query language is working now

$ curl -H 'Accept: application/vnd.twitchtv.v5+json' -H 'Client-ID: CLIENT_ID' -X GET 'https://api.twitch.tv/kraken/streams/?language=ru&limit=1'

{
    "streams": [{
        "_id": 1026335809,
        "game": "Counter-Strike: Global Offensive",
        "broadcast_platform": "live",
        "community_id": "",
        "community_ids": [],
        "viewers": 31152,
        "video_height": 1080,
        "average_fps": 59,
        "delay": 0,
        "created_at": "2020-03-31T11:57:58Z",
        "is_playlist": false,
        "stream_type": "live",
        "preview": {
            "small": "https://static-cdn.jtvnw.net/previews-ttv/live_user_csgomc_ru-80x45.jpg",
            "medium": "https://static-cdn.jtvnw.net/previews-ttv/live_user_csgomc_ru-320x180.jpg",
            "large": "https://static-cdn.jtvnw.net/previews-ttv/live_user_csgomc_ru-640x360.jpg",
            "template": "https://static-cdn.jtvnw.net/previews-ttv/live_user_csgomc_ru-{width}x{height}.jpg"
        },
        "channel": {
            "mature": false,
            "status": "[RU] Virtus.pro vs mousesports (0-1) BO3 | ESL PRO LEAGUE SEASON 11 by @__KvaN \u0026 @LeniniwTv",
            "broadcaster_language": "ru",
            "broadcaster_software": "",
            "display_name": "csgomc_ru",
            "game": "Counter-Strike: Global Offensive",
            "language": "ru",
            "_id": 213748641,
            "name": "csgomc_ru",
            "created_at": "2018-04-12T14:47:31.293685Z",
            "updated_at": "2020-03-31T18:26:12.794837Z",
            "partner": true,
            "logo": "https://static-cdn.jtvnw.net/jtv_user_pictures/4bf37688-7b19-4d3f-9d56-11740ad38c4d-profile_image-300x300.png",
            "video_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/bf17f22c-22e9-475c-a2cf-17cced913abd-channel_offline_image-1920x1080.png",
            "profile_banner": "https://static-cdn.jtvnw.net/jtv_user_pictures/9ee1d436-5aa4-482c-a33f-de7eb396315b-profile_banner-480.png",
            "profile_banner_background_color": "",
            "url": "https://www.twitch.tv/csgomc_ru",
            "views": 24068669,
            "followers": 331500,
            "broadcaster_type": "",
            "description": "",
            "private_video": false,
            "privacy_options_enabled": false
        }
    }]
}

only works for a single language as the doc says it suposed to be... tested for lives, vods and clips

oliverfindl commented 4 years ago

Hello,

can confirm, it's working in my use-case.

Thanks.

fgl27 commented 4 years ago

Questions remains???

Is broadcaster_language dead and gone? for ever?

Will the 500 error from clips api be fixed? on the same issue?

Because it persist, can't load more then 100 clips when using a language.

curl -s \
-H "Accept: application/vnd.twitchtv.v5+json" \
-H "Client-ID: the-id" \
"https://api.twitch.tv/kraken/clips/top?limit=100&period=day&cursor=MTAw&language=en" \
| jq
{
  "error": "Internal Server Error",
  "status": 500,
  "message": ""
}
bastimeyer commented 4 years ago

Is broadcaster_language dead and gone?

Looks like it.

What's really sad is that previously, multiple language codes could be specified by separating them with a comma, and now with the removal of the broadcaster_language parameter, the only remaining option language doesn't support this and an empty list gets returned. Not to mention that language doesn't describe the stream's language, but the channel's language instead, which is wrong when searching for streams in a specific language.

jbulava commented 4 years ago

Hi everyone, I wanted to follow up with more details. The v5 changes related to offset and _total announced in February, as a result of internal service changes, also affected the language parameter and that was a miss in communication.

To resolve the filtering issue reported here, the team deployed an update on March 30 that takes the language parameter you provide and uses that to filter on the broadcaster language associated with streams for the results.