Last active
February 13, 2016 14:41
-
-
Save dorukcan/c047dab00037782f7890 to your computer and use it in GitHub Desktop.
followings who write most at recent 1000 tweet
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
from twython import Twython | |
def main(): | |
APP_KEY = "" | |
APP_SECRET = "" | |
OAUTH_TOKEN = "" | |
OAUTH_TOKEN_SECRET = "" | |
twitter = Twython(APP_KEY, APP_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET) | |
my_timeline = twitter.get_home_timeline(count = 200) | |
my_timeline.extend( twitter.get_home_timeline(count = 200, max_id = my_timeline[len(my_timeline)-1]['id']) ) | |
my_timeline.extend( twitter.get_home_timeline(count = 200, max_id = my_timeline[len(my_timeline)-1]['id']) ) | |
my_timeline.extend( twitter.get_home_timeline(count = 200, max_id = my_timeline[len(my_timeline)-1]['id']) ) | |
my_timeline.extend( twitter.get_home_timeline(count = 200, max_id = my_timeline[len(my_timeline)-1]['id']) ) | |
result = {} | |
for tweet in my_timeline: | |
username = tweet['user']['screen_name'] | |
result[username] = result.get(username, 0) + 1 | |
print sorted(result.items(), key=lambda x: x[1], reverse=True) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment