Python development – scrap stream data

Looking for a Python scraping Developer in Boston MA area? Contact OT PROJECTS.


from lxml.html import fromstring
from lxml.etree import tostring

import urllib2


request=urllib2.urlopen("http://www.yahoo.com")



html=request.read()


try:

	root=fromstring(html)

except Exception, e:

	print "root", e
	continue
	
	
p_tags=root.xpath("//p[contains(@class,'stream-summary')]")




for p in  p_tags:
	try:
		print p.text
		print
	except Exception, e:
		print e
		exit()

print "End",



Looking for a Python scraping Developer in Boston MA area? Contact OT PROJECTS.