Implemented a trending topics search function. Returns an array of dictionary items to loop through - fairly snazzy.
This commit is contained in:
parent
91fc174fdc
commit
f2553f81dc
1 changed files with 5 additions and 3 deletions
8
tango.py
8
tango.py
|
|
@ -26,8 +26,10 @@ class tango:
|
||||||
return formattedTimeline
|
return formattedTimeline
|
||||||
|
|
||||||
def getTrendingTopics(self):
|
def getTrendingTopics(self):
|
||||||
|
# Returns an array of dictionary items containing the current trends
|
||||||
trendingTopicsURL = "http://search.twitter.com/trends.json"
|
trendingTopicsURL = "http://search.twitter.com/trends.json"
|
||||||
trendingTopics = simplejson.load(urllib.urlopen(trendingTopicsURL))
|
trendingTopics = simplejson.load(urllib.urlopen(trendingTopicsURL))
|
||||||
pass # for now, coming soon
|
trendingTopicsArray = []
|
||||||
|
for topic in trendingTopics['trends']:
|
||||||
|
trendingTopicsArray.append({"name" : topic['name'], "url" : topic['url']})
|
||||||
|
return trendingTopicsArray
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue