Using the curl output I can easily get the pagination value to retrieve all the subscribers on a channel, but if I use python API I’m able to get the first batch (up to 100 which is the limit based on documentation here Twitch API — twitchAPI v3.11.0 documentation ) but in the output generated which is a BroadcasterSubscriptions object (defined here Objects used by the Twitch API — twitchAPI v3.11.0 documentation ) there is no pagination value.
How can I retrieve more than 100 subscribers via this method?
You won’t get a pagination value if there are no more records.
So if a broadcaster has 50 subscribers but you set first 100.
Then you won’t get a pagination value.
If the caster in question does have more than 100 broadcasters and you are not getting a pagination value to use with this library it would suggest that there is a bug in the library and you might want to reach out to the libraries developers for guidance, it’s tough to give advice about specific libraries on the general help forum. (someone might notice and answer but might not and rather than leave you hanging I’m hoping to get you redirected to a more helpful place)
I believe they hold a presence on the Libraries Discord - Twitch API
I have more than 20 subscriptors and if I ask for the first 20 I don’t get the pagination value for the next values.
Also on BroadcasterSubscriptions object there is no way to determine the pagination value (even using to_dict)
In any case if I use curl I get IN ANY CASE the pagination value even if there are less than 100 entry.
Since the library is the official one from Twitch I think it is something to consider.
Twitch doesn’t create official libraries (except for the Game Developer Plugins of which this Python library is not), the library you are using is not created by or directly supported by Twitch.
The one you are using is provided by third parties.
So it’s a bug in the library you are using and needs to be reported to them so they can resolve.
They have a channel on the Libraries Discord: Twitch API or whereever their code is, which I guess would be GitHub → GitHub - Teekeks/pyTwitchAPI: A Python 3.7 compatible implementation of the Twitch API, EventSub, PubSub and Chat
Yeah, my mistake, I forgot this endpoint goes forwards and backwards (before/after) - Reference | Twitch Developers
Hello, developer of that library here.
Since Version 3, you no longer need to manually paginate to access all pages (as described here: Objects used by the Twitch API — twitchAPI v3.11.0 documentation )
The above link also contains an example for how to iterate over all values, including new pages.
If you for some reason absolutely HAVE to get your hands on the paginator, you could access it with
broadcaster_subscriptions = await twitch.get_broadcaster_subscriptions('123123') paginator = broadcaster_subscriptions._data['param']['after']
However there should be no reason to ever need that unless you mix the use of this library with raw curl calls.
Thanks for the reply.
I will do some tests, but in the documentation it is clearly stated you retrieve the first n values (with n less than 100) how can I retrieve the other values without pagination being exposed?
I have a workaround using curl to get all the data and parsing it, but this makes the library less effective.
I will report back after the tests
The after parameter is just still there for people who mix this library with curl etc. there is no need to specify it.
first basically just specifies the batch size the library fetches with.
With normal use you dont have to specify either of those.
However the docs are not 100% clear on that (although it does explicitly specify in multiple places that it auto paginates). Thats why I also still have this issue open: specify the use of first and after in docs · Issue #235 · Teekeks/pyTwitchAPI · GitHub
To summarize: you have to change nothing to access all values, the library handles pagination.
After a few tests I confirm the solution, just remove first as option and the library will return all the values.
Nice to have, but the documentation is not very clear on this.
In any case thanks a lot for your help
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.