_total no longer avaible

Python3.6 - Kraken

link = 'https://api.twitch.tv/kraken/streams/?channel=' + channels
    async with aiohttp.ClientSession() as session:
      async with session.get(link, headers={'Client-ID': client_id, 'Accept': accept}) as r:
        if '_total' in await r.text():
          ..

That’s my code, since a few days that no longer works, I discovered that the problem is that into the response there is _total no more. Am I doing something wrong? Is there a new way to check _total of elements returned into the response?

I think I’m gonna extract json from the response and check the total using len(streams).

_total was removed

1 Like

The “Get Live Streams ” and “Get Followed Streams ” v5 endpoints will no longer return a _total count field in the response. We recommend migrating to Helix to retrieve the total count.

I cannot see the _total parameter here Reference | Twitch Developers
What am I missing?

Thats helix. Not Kraken

Helix also doesn’t have a total field
The post I linked to refer to Kraken (aka v5)

Your OP didn’t declare if using Kraken or Helix

That’s my fault, I’m using Kraken (also edited the main post)
link = 'https://api.twitch.tv/kraken/streams/?channel=' + channels

Then Helix and Kraken both don’t have a _total field?

The “Get Live Streams ” and “Get Followed Streams ” v5 endpoints will no longer return a _total count field in the response. We recommend migrating to Helix to retrieve the total count.

If this talk about Kraken, it says that Kraken has not longer the _total parameter, but if I’d like to use it, I have to move to Helix but as I posted, Helix doesn’t have that _total parameter too.

So my question could be, is it still possibile to get the _total parameter somewhere? How can I do it?

No

iterate all pages and add it up yourself

Using you example where you are calling a predefined set of channels.

Count the size of the helix {data:[]} in the response

link = 'https://api.twitch.tv/kraken/streams/?channel=' + channels

Would become

link = 'https://api.twitch.tv/helix/stream?user_id=x&user_id=x&user_id=x&user_id=x'

(You may also need to include the first if calling more than 25 ID’s)

And then count the size of the data key in the JSON response

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