Pagination with /helix/subscriptions

How would I use pagination in python? The way its done is very confusing. The endpoint im using is /helix/subscriptions

The API returns a pagination->cursor

You then call the same URL you already are for apge one and add a after=cursorvalue to the URL.

https://api.twitch.tv/helix/subscriptions?broadcaster_id=ID&after=CUSROR
{
subshere
"pagination": {
"cursor": "SOMECUROR"
}
}
1 Like

How would i loop through it though the to get the true count? in one statement

Err not sure what you are after there.

You’d have to loop each page to count the number of subs you have.

Or you can fetch once the update your total using sub/unsub notifications from Webhooks

The total will be outputted each user subscription using a webhook?

No

You’d fetch once store that in a database, then use webhooks to update the database, then count the active subscriptions from your database

I can’t get past ones though

oh i get what you’re saying. Manually going through the subs with the cursor and store em. then on subscription, store em

Yup!

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