Hi, I have retrieved all of the followers of a twitter account (around 150K followers) and now I want to iterate through the list of follower IDs and retrieve all of their tweets in 2021 (and later add this tweet data into a dataframe).
When I use api.user_timeline, it works but only 900 requests are possible. So now I am using client.get_users_tweets as 1500 requests are apparently possible. However, when I try to run the code (in the attached picture), there is an exception: ‘TweepyException: This method does not perform pagination’.
Is there an alternative way to achieve the results that I want?
You are mixing v1.1 API calls with v2 API, since Tweepy supports both, you need to make sure you don’t use the v1.1 classes for v2 calls or the other way around.
An alternative is to use twarc, you can create a text file with 1 user ID per line and get all their tweets in o e command but this may be a very large volume of tweets, most likely too large for a single dataframe, so I recommend setting limits. See twarc2 (en) - twarc for options. --use-search will only work if you have academic access. twarc2 commands are for v2 API and twarc commands are for v1.1 in case you need.
ok thanks. So in order to retrieve tweets for a list of users, you have to have academic access?
Also, if I don’t have academic access, can tweets only be retrieved up to 7 days in the past?
Oh, no, you only need academic access to get tweets older than 7 days, otherwise the standard v2 API limits apply, and you have to wait if you’ve used the number of calls in 15 minutes for it to reset again.
system
closed
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.