Twitter Data Scraping using Tweepy in 2025
Note that to select Read and write in App permissions under User authentication settings. client = tweepy.Client( bearer_token=BREARER, consumer_key=API_KEY, consumer_secret=API_KEY_SECRET, access_token=ACCESS_TOKEN, access_token_secret=ACCESS_TOKEN_SECRET, return_type = dict, wait_on_rate_limit = True ) response = client.search_recent_tweets( "artifical intelligence OR machine learning lang:en", max_results = 10, tweet_fields = ['author_id','created_at','text'] )

Note that to select Read and write in App permissions under User authentication settings.
client = tweepy.Client(
bearer_token=BREARER,
consumer_key=API_KEY,
consumer_secret=API_KEY_SECRET,
access_token=ACCESS_TOKEN,
access_token_secret=ACCESS_TOKEN_SECRET,
return_type = dict,
wait_on_rate_limit = True
)
response = client.search_recent_tweets(
"artifical intelligence OR machine learning lang:en",
max_results = 10,
tweet_fields = ['author_id','created_at','text']
)