Created
November 4, 2014 12:03
-
-
Save jahil/45824357a572f1b78e22 to your computer and use it in GitHub Desktop.
Twitter Trends - Major Cities of Pakistan
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
#!/usr/bin/python | |
from twython import Twython | |
CONSUMER_KEY = 'XXXXXXXXXXXXXXXXXXXX' | |
CONSUMER_SECRET = 'XXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
ACCESS_KEY = 'XXXXXXXXXXXX' | |
ACCESS_SECRET = 'XXXXXXXXXXXXX' | |
api = Twython(CONSUMER_KEY,CONSUMER_SECRET,ACCESS_KEY,ACCESS_SECRET) | |
trends = [ ] | |
fsd = [ ] | |
lhr = [ ] | |
khi = [ ] | |
trends = api.get_place_trends(id=23424922) | |
lhr = api.get_place_trends(id=2211177) | |
khi = api.get_place_trends(id=2211096) | |
fsd = api.get_place_trends(id=2211574) | |
tr = [t['name'] for t in trends[0]['trends']] | |
tfsd = [t['name'] for t in lhr[0]['trends']] | |
tlhr = [t['name'] for t in fsd[0]['trends']] | |
tkhi = [t['name'] for t in khi[0]['trends']] | |
tlhr = ' '.join(tlhr) | |
print "Trends in Pakistan" | |
print str(tr) | |
print "\nTrends in Lahore" | |
print str(tlhr) | |
print "\nTrends in Karachi" | |
print str(tkhi) | |
print "\nTrends in Faisalabad" | |
print str(tfsd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment