3

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

gre_gor
  • 6,669
  • 9
  • 47
  • 52
Othoninho
  • 51
  • 3
  • 2
    The error message literally answers your question. – SimonUnderwood Apr 23 '23 at 03:00
  • Now the error message is outdated. There is no Elevated access form on Twitter's developer portal, and you only need the free tier to access the authenticated user's data. – Scott May 03 '23 at 16:14

2 Answers2

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

jsHate
  • 499
  • 1
  • 3
  • 20
0

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

Zak_Stack
  • 103
  • 8