Get Online Streams from a Community

Hello, I’m trying to get a list of online Streams in a Community.
I know about this Curl request:

curl -H ‘Accept: application/vnd.twitchtv.v5+json’ \
-H ‘Client-ID: SECRET’ \
-X GET ‘https://api.twitch.tv/kraken/streams/?community_id=COMMUNITYID

However it returns only 24 Streams. If there are more live I dont receive them. Now I’m wondering if there is a way to get a full list?

Greetings

Look at this:

You need to make repeated requests in the loop, and in each subsequent request you need to specify the pagination in the after.
Also look at the parameter ‘after’, if you want to get more streamers in one query.

1 Like

Thanks for your reply, those look promising but what would the request URL look like?
I’ve been trying these:
https://api.twitch.tv/kraken/streams/?first=20?community_id=4d2aef2c-35f5-40b3-8a0e-35a79d7175c5
^This gives me a lot of streams but not the ones in the community and no pagination
https://api.twitch.tv/kraken/streams/?community_id=4d2aef2c-35f5-40b3-8a0e-35a79d7175c5?first=20
^ This is a empty response
https://api.twitch.tv/kraken/streams/?first=20&community_id=4d2aef2c-35f5-40b3-8a0e-35a79d7175c5
^ This gives me the streams in the community but no pagination

I’m not very familiar with the API and just guessing, so maybe you could help me out :smiley:

? is the start of the querystring, each parameter/value pair is separated with an &, not ?, which is why your first 2 didn’t work as intended.

Also, you’re still using kraken, the new API would be https://api.twitch.tv/helix/streams?first=20&community_id=4d2aef2c-35f5-40b3-8a0e-35a79d7175c5

this returns the first 20 streams with that community ID in a data array, there’s also a pagination field which contains a cursor which can be set as the after querystring parameter to fetch the next set of results (which will contain a cursor for the next page, and so on).

1 Like

You two are heros. Thanks for saving the day!

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