python - Grabbing a users followers with Twython -
i have code grab specific users followers shown below. further not grab user's followers followers own followers. example grab carl icahns followers id's , followers own followers id's. if following carl icahn, able retrieve of followers well. also, reason grabbing same 5000 followers each call reason instead of getting different 5000 every time. can please me this? appreciate it.
import logging import time import csv import twython import json app_key = "**********" app_secret = "**********" oauth_token = "***********" oauth_token_secret = "**************" twitter = twython.twython(app_key, app_secret, oauth_token, oauth_token_secret) followers = twitter.get_followers_ids(screen_name = "carl_c_icahn") follower_id in followers: print ("carl icahn followers:", followers) open('carlfollowers.txt', 'a') outfile: json.dump(followers, outfile, sort_keys = true, indent = 4)
little change in code:
import logging import time import csv import twython import json app_key = "**********" app_secret = "**********" oauth_token = "***********" oauth_token_secret = "**************" twitter = twython.twython(app_key, app_secret, oauth_token, oauth_token_secret) followers = twitter.get_followers_ids(screen_name = "carl_c_icahn") open('carlfollowers.txt', 'a') outfile: follower_id in followers: print("carl icahn follower:", follower_id) json.dump(follower_id, outfile, sort_keys = true, indent = 4)
Comments
Post a Comment