-
-
Save DrSensor/67dd89f7c708b456d6ddc3be34733ad8 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, json, time, sys | |
auth = tweepy.OAuth1UserHandler( | |
<api keys here> | |
) | |
api = tweepy.API(auth) | |
d = json.loads(open(sys.argv[1]).read().split("=", 1)[1]) | |
BATCH=100 | |
users = [] | |
for i in range(0, len(d), BATCH): | |
ids = [] | |
for f in d[i:i+BATCH]: | |
ids.append(f["following"]["accountId"]) | |
u = api.lookup_users(user_id=ids) | |
users.extend(i._json for i in u) | |
print(f"{i+100}/{len(d)}") | |
open("users.json", "w").write(json.dumps(users)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment