I use npm-twit to get subscribers to a specific account.
The Twitter API returns up to 5,000 results from a single GET request.
If the user I request has more than 5,000 followers, the value "next_cursor" with the data is returned.
To get the following 5000 results, I need to re-run the GET function, passing it the next_cursor value as an argument. I just can't figure out how to do this.
I was thinking about a while loop, but I cannot reset the global variable, I think, due to the scope:
var cursor = -1 while ( cursor != 0 ) { T.get('followers/ids', { screen_name: 'twitter' }, function (err, data, response) {
Obviously, I'm not a JS genius, so any help would be greatly appreciated.
source share