Anyone have any advice on how to get all followers of a streamer without manually writing new requests

Don’t run the request inside a loop.

Instead, create a function that will make 1 request, and take an optional pagination parameter.

This way you call the function once, it makes the request and once it gets the results you can check if there are more results to get and if so you have the function call itself but this time pass it the pagination cursor. This way the function will keep being called and keep passing itself the next cursor each time.

What you do with the results is up to you, as an example for followers, you could concatentate the results in an array outside the function, that way each time the function gets called it adds 100 (or whatever limit you set) followers to the array, and keeps calling itself until it has all of the followers, at which point it stops calling itself and does something else with your now complete results.

1 Like