Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter API v2 - Free Version - Getting Follower Numbers - 2023

Does anyone know if it is still possible to collect the number of followers for a given Twitter account using the free version of the Twitter v2 API (after Feb 9th, 2023)?

I tried getting access to the API using the following code, but got the following error:

import tweepy
import requests

# Replace with your own keys and tokens

API_KEY = 'persnal key'
API_SECRET_KEY = 'persnal key'
ACCESS_TOKEN = 'persnal key'
ACCESS_TOKEN_SECRET = 'persnal key'

# Authenticate using your keys and tokens

auth = tweepy.OAuthHandler(API_KEY, API_SECRET_KEY)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)

# Create the API object

api = tweepy.API(auth)

def get_followers_count(screen_name):
    user = api.get_user(screen_name=screen_name)  # Update this line
    return user.followers_count

# Replace 'screen_name' with the desired Twitter account's screen name

screen_name = 'account_x'
followers_count = get_followers_count(screen_name)

print(f'The number of followers for {screen_name} is: {followers_count}')

Error: Forbidden: 403 Forbidden 453 - You currently have Essential access which includes access to Twitter API v2 endpoints only. If you need access to this endpoint, you’ll need to apply for Elevated access via the Developer Portal. You can learn more here: https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#v2-access-leve

like image 224
Othoninho Avatar asked Dec 09 '25 08:12

Othoninho


1 Answers

I think you are using twitter api v1 while you have access only to API v2

In api v2 free tier you can access only to post tweets and GET /2/users/me, where you can get user details including follower count

https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/user

like image 87
jsHate Avatar answered Dec 11 '25 22:12

jsHate