Created
September 18, 2012 19:47
-
-
Save perone/3745395 to your computer and use it in GitHub Desktop.
Trends Twitter
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 | |
import codecs | |
BRAZIL_WOEID = 23424768 | |
twapi = tweepy.API() | |
ret = twapi.trends_location(woeid=BRAZIL_WOEID) | |
fhandle = codecs.open("file.txt", "w", encoding="utf-8") | |
for trend in ret[0]['trends']: | |
se = twapi.search(rpp=1, q=trend['query'])[0] | |
fhandle.write("%s = %s\n" % (se.from_user_name, se.text)) | |
fhandle.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment