Created
March 6, 2020 21:23
-
-
Save jbn/f287fd5d173a14469e361611837130bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tweepy # pip install tweepy | |
import json | |
import time | |
from missing_builtins import chunker # pip install missingbuiltins | |
with open("twitter_creds.json") as fp: # Yours with the fields below | |
creds = json.load(fp) | |
auth = tweepy.OAuthHandler(creds['appKey'], creds['appSecret']) | |
auth.set_access_token(creds['userToken'], creds['userSecret']) | |
api = tweepy.API(auth) | |
follower_ids = set(tweepy.Cursor(api.followers_ids, count=5000).items()) | |
followers = {} | |
for i, chunk in enumerate(chunker(follower_ids, 100)): | |
print(f"Group: {i}") | |
for user in api.lookup_users(chunk): | |
followers[user.id] = user | |
for user in followers.values(): | |
if hasattr(user, 'status'): | |
print(user.screen_name, user.status.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
brb gonna go build this