javascripttwitterrate-limitingtwitter-api-v2

How to get all followers from a specific user using twitter-api-v2


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?


Solution

  • X Developer Platform docs state that "Follows lookup" is only available on the Enterprise plan.

    The Enterprise plan is the most expensive plan, and doesn't have a public price. The plan below is it is Pro, which currently costs $5000/month.

    GET followers/list was available in API v1.1, which stopped working in Apr 2023.

    So, X currently has no affordable way to programmatically get even your own followers.