Get streams that have no set game

Hello there,
For a Discord bot I’m working on, users requested to be able to retrieve online streams that don’t have a set game. I know it’s easy to retrieve streams that are currently playing a game, but I couldn’t find how to get those with no game set.

Best regards,
Gyoo.

I know of no direct end point for streams without games, but you could traverse all streams and pick out those without games set.

curl -sH "Client-Id: $TWITCH_CLIENT_ID" \
"https://api.twitch.tv/kraken/streams?offset=${offset:-0}&limit=100" | \
jq -r '.streams[] | select(.game == null)'

Thanks for your reply

After searching on my side, this was also the (only) solution I’ve found. However, considering my application is doing lots of requests per second, having to go through this over everything else may be too consuming and I think it’d slow down my bot too much.

I guess I’ll skip that for now, and maybe one day there will be easier ways to do this.

Your bot shouldn’t be hitting the streams api more than ~once a minute due to caching across the board (as in, one full iteration of the streams api). Issuing a ton of requests to the streams api will just return the same results since output is cached for a duration.

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