Get the fewest Viewer count of an game & stream?

How to get the less Viewer Count of an Stream of an Game, is my question?

$resp = json_decode($response);
$viewerCount = $resp->data[0]->viewer_count;
$name = $resp->data[0]->user_name;

$channelsApi = 'https://api.twitch.tv/helix/streams?first=1&language=de&game_id=';

Please stop creating duplicate threads and just use one.

To answer your question though you simply use the Get Streams endpoint, specify the game, and paginate through all the pages of results. Once you have the results, do whichever filtering or ordering you like on your end.

I am sorry, the other one was with the most viewers, so i thought i should seperate.

So i should use before instead of first?

As the docs tell you, first is how many results you want to get with each request (up to 100), and you should use after to paginate with the cursor.

So how i get the last data entry? Of using first and 20 for 100 entries?

Pagination equal 100?

Or after 100

please read the documentation!

Set first to however many results you wish to get on each page.

Set after to the cursor provided in the last request.

Repeat until you have all results.

Thanks

It’s not worth the hassle/fetching.

99% of the time it’ll be some random with zero viewers as a small streamer, or a big streamer that literally just went live.

Hello, I have an other Question, is it possible to sum the total count of viewers for an game of game id and sort it by language by the Twitch API?

Yes

Can you maybe tell how?

Make the relevant API calls and then compare and sort the data you have retrieved.

So I ve tried but get ever the count of just one Streamer!

https://api.twitch.tv/helix/streams?first=1&language=de&game_id=

first=1 will return the first one records

$resp2 = json_decode($response2);
$viewerCount2 = $resp2->data[0]->viewer_count;

so how it is possible to set for all?

first=100 gets you the first 100 records and then you follow the pagination

we covered that here: