Last active
October 13, 2015 01:57
-
-
Save fmasanori/4121001 to your computer and use it in GitHub Desktop.
Python Twitter Trending Topics
This file contains hidden or 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
# | |
# API DEPRECATED AT JUNE 2013 | |
# https://dev.twitter.com/docs/faq#17750 | |
# | |
import urllib, json | |
def trend_topics(): | |
url = 'https://api.twitter.com/1/trends/1.json' | |
resp = urllib.urlopen(url).read() | |
data = json.loads(resp) | |
return data | |
for resp in trend_topics(): | |
for trend in resp['trends']: | |
print (trend['name']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment