Is there a better way to get a list of followers screen names with Tweepy than this:
for follower in api.followers_ids('twitter'):
print api.get_user(follower).screen_name
The followers() method of the API class in Tweepy module is used to get the specified user's followers ordered in which they were added. Example 1 :The followers() method returns the 20 most recent followers. Example 2: More than 20 followers can be accessed using the Cursor() method.
If you need more than 100 Tweets, you have to use the paginator method and specify the limit i.e. the total number of Tweets that you want. Replace limit=1000 with the maximum number of tweets you want. Replace the limit=1000 with the maximum number of tweets you want (gist).
Tweepy provides the API interface for the Twitter API v1. 1. For the v2 API, Tweepy provides the Client interface. This is available from Tweepy v4.
I think this is more efficient:
for user in tweepy.Cursor(api.followers, screen_name="twitter").items():
print user.screen_name
FYI, it uses followers/list twitter API call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With