skip to Main Content

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 followin 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

2

Answers


  1. 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

    Login or Signup to reply.
  2. The Twitter Api is still working in 2023, but sometimes the api credentials in the app get suspended , so you just need to create new app in the twitter developper platform;

    I found this interesting 2023 tutorial of how to extract twitter data in python , and it still working, here is the videos links

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search