Skip to content

Instantly share code, notes, and snippets.

@mys721tx
Last active January 5, 2018 01:19
Show Gist options
  • Save mys721tx/7d6432f9fc090396f488da95317118b0 to your computer and use it in GitHub Desktop.
Save mys721tx/7d6432f9fc090396f488da95317118b0 to your computer and use it in GitHub Desktop.
Get twitter followers
"""
get_follower.py
"""
import twitter #python-twitter
auth = {
"consumer_key": "",
"consumer_secret": "",
"access_token_key": "",
"access_token_secret": ""
}
api = twitter.Api(**auth)
next_cursor = -1
with open("follower.csv", "w") as data:
while True:
next_cursor, _, users = api.GetFollowersPaged(
screen_name="",
cursor=next_cursor
)
for user in users:
data.write("{}\n".format(user.id))
if not next_cursor:
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment