twitools/followertxt.py

20 lines
463 B
Python
Executable file

#!/usr/bin/env python3
import config, tools
import tweepy
outfile = "followers.txt"
auth = tweepy.OAuthHandler(config.cke, config.cse)
auth.set_access_token(config.ato, config.ase)
api = tweepy.API(auth)
follower_ids = api.followers_ids(screen_name=config.name)
with open(outfile, 'a') as f:
for page in tools.paginate(follower_ids, 100):
followers = api.lookup_users(user_ids=page)
for follower in followers:
f.write(follower.screen_name + "\n")