Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The best way to get a list of followers in Python with Tweepy

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
like image 849
user2547755 Avatar asked Jul 03 '13 18:07

user2547755


People also ask

How do I get my followers list on Tweepy?

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.

How can I get more than 100 tweets on Tweepy?

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

Does Tweepy work with v2?

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.


1 Answers

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.

like image 185
alecxe Avatar answered Sep 19 '22 11:09

alecxe