Posted By

vetri02 on 12/02/10


Tagged

pythonBeautifulSoup


Versions (?)

Twitter feed on Python using YQL and BeautifulSoup


 / Published in: Python
 

Uses YQL's Rest query (select * from twitter.user.timeline where id='vetri02')

  1. import urllib2
  2. from BeautifulSoup import BeautifulStoneSoup
  3. var = raw_input("Enter your Twitter id: ")
  4. print "Tweets of", var
  5. er = "http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20twitter.user.timeline%20where%20id%3D'"
  6. fg = "'&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys"
  7.  
  8. zx = er+var+fg
  9.  
  10. page = urllib2.urlopen(zx)
  11. soup = BeautifulStoneSoup(page)
  12. tweet = soup.findAll('text')
  13. for twt in tweet:
  14. print twt.string

Report this snippet  

You need to login to post a comment.