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

Videos endpoint empty data array when specifying a game_id #651

Open
Dkamps18 opened this issue Sep 7, 2022 · 1 comment
Open

Videos endpoint empty data array when specifying a game_id #651

Dkamps18 opened this issue Sep 7, 2022 · 1 comment
Labels
product: api API endpoints in the "helix" namespace

Comments

@Dkamps18
Copy link
Contributor

Dkamps18 commented Sep 7, 2022

Brief description
Videos endpoint returns an empty data array when specifying a game_id and querying from a browser.

How to reproduce
Call the videos api with a game_id from any browser.

Expected behavior
Match the behavior of the endpoint when being called from outside a browser

Screenshots
Not a screenshot but you can use this page as an example

Additional context or questions
Only broken when querying from a browser

@Dkamps18 Dkamps18 added the product: api API endpoints in the "helix" namespace label Sep 7, 2022
@BarryCarlyon
Copy link
Contributor

I narrowed down the problem on this one.

Browser fetch (and by extension nodeJS inbuild fetch: aka Fetch that follows the spec), adds a accept-langauge header.

If that header is set to the value of * or anything valid, such as en-US for example, you get no results

But if you set the header to jibberish, then you get results

let url = 'https://api.twitch.tv/helix/videos?game_id=32399';

let r = await fetch(
    url,
    {
        method: 'GET',
        headers: {
            'Client-ID': `${client_id}`,
            'Authorization': `Bearer ${token}`,
            'Accept': 'application/json',
            'accept-language': 'YOUWHAT'
        }
    }
);
let p = await r.json();

console.log(p);

@Dkamps18 Dkamps18 changed the title Games endpoint empty data array when specifying a game_id Video's endpoint empty data array when specifying a game_id Jul 19, 2023
@Dkamps18 Dkamps18 changed the title Video's endpoint empty data array when specifying a game_id Videos endpoint empty data array when specifying a game_id Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product: api API endpoints in the "helix" namespace
Projects
None yet
Development

No branches or pull requests

2 participants