Hi i'm trying to get all users that follow a specific account on twitter, so I made this code using twitter-api-v2
const followers = await reader.v2.followers(userId)
let next_token = followers.meta.next_token
let flist = []
followers.data.map(e => flist.push(e.username))
while(next_token !== undefined){
const more = await reader.v2.followers(userId, { asPaginator: true, pagination_token: next_token })
next_token = more?.meta?.next_token
more.data.data.map(e => flist.push(e.username))
}
But when I run the code, I get "Too Many Requests", for reaching the twitter followers endpoint rate limit, and idk what to do, is it impossible? i saw many many bots that do that and I just can't?
You can get this API in v2
Getting started with the follows lookup endpoints
Example
Result
I just 3 followers among
9.6 millions
.How to get all?
That API get maximum 1000 for each API call. So first call get 1000 followers next API call with
next_token
get other 1000 followers, so if want to get 9.6 Millions, you have to call about 9600 API calls.This is full code for get 1000 followers.
Result
For next 1000 get followers This call will be get with
pagination_token
<- before call'snext_token
Relation between
HTTP call with GET parameters
andAxios parameters
It makes how many number of data and each item what kinds of data fields want to get from Tweeter server.If you want to add more user fields, look this URL