Advertisement
fmasanori

Simple Python 2.x Twitter Client

Jul 7th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. # Credits Pamela Fox
  2. import urllib, json
  3.  
  4. def busca_tweets(texto='python'):
  5.   url = 'http://search.twitter.com/search.json?q=' + texto
  6.   resp = urllib.urlopen(url).read()
  7.   data = json.loads(resp)
  8.   return data['results']
  9.  
  10. def print_tweets(tweets):
  11.   for t in tweets:
  12.     print (t['from_user'] + ': ' + t['text'] + '\n')
  13.  
  14. resultados = busca_tweets('TDC2012')
  15. print_tweets(resultados)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement