Created
January 10, 2013 07:51
-
-
Save sauravtom/4500263 to your computer and use it in GitHub Desktop.
Fetch tweet of a given username in command line
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 urllib2 | |
import json | |
def get_tweets(name): | |
s = urllib2.urlopen("http://search.twitter.com/search.json?q="+name).read() | |
x = json.loads(s) | |
for i in range(len(x['results'])): | |
print "%s.%s--> %s\n" %(i, x['results'][i]['from_user_name'], x['results'][i]['text']) | |
name = raw_input("Enter the twitter-username get recent tweets: ") | |
get_tweets(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment