Get streams by tag

I was checking the docs and I saw that it’s not possible to get a list of streams from a tag, the only way would be to get the streams and check one by one if it has tag I’m looking for. I’m kind of new to programming and my question is how to do this in an effective way so as not to consume too many requests

You answered your own question

Poll get streams, 100 at a time, and filter out the streams that don’t match your tag(s), then get the next page and continue…

there is no concern about hitting the rate limit here since you can only get one page of streams at a time.

A uservoice exists for this Search streams by Tag name – Twitch UserVoice

1 Like
const url = `https://api.twitch.tv/helix/streams`;

    let authorizationObject = await getTwitchAuthorization();
    let { access_token, expires_in, token_type } = authorizationObject;

    token_type =
    token_type.substring(0, 1).toUpperCase() +
    token_type.substring(1, token_type.length);

    let authorization = `${token_type} ${access_token}`;
    let headers = {
        authorization,
        "Client-Id": clientId,
    };

    const requestStreams = await fetch(url, {headers,})

How can I get to the next page?

The response will return a pagination->cursor which you can then use with the after parameter to get the next page

For example Browser Categories | Twitch API Example demonstrates iterating Get Streams

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.