How to use the API to get the top 20 streams

Get an access token

Then call

Call

https://api.twitch.tv/helix/streams?first=20

Pure JS example, this fetches (and estimates the view count of) the “top games”, but you can easily swap the “flow” to get the top 20 streams instead

https://barrycarlyon.github.io/twitch_misc/examples/browse_categories/

This uses implicit auth to get the needed token.

For what you describe the code would be running on a server (for caching purposes) and you’d probably use a client_credentials access token for server to server requests

For this python lib under Kraken looks like you need

from twitch import TwitchClient
client = TwitchClient(‘’)
streams = client.streams.get_live_streams()

Which would return 25 streams

But you really should be using Helix since kraken is deprecated

https://python-twitch-client.readthedocs.io/en/latest/helix.html

import twitch
client = twitch.TwitchHelix(client_id='<client_id>', client_secret='<client_secret>')
client.get_oauth()
client.get_streams()

My python is rusty.