Skip to content

Instantly share code, notes, and snippets.

@audiodude
Created February 14, 2010 15:51
Show Gist options
  • Save audiodude/304101 to your computer and use it in GitHub Desktop.
Save audiodude/304101 to your computer and use it in GitHub Desktop.
from lxml import etree
from urllib2 import urlopen, HTTPError
try:
etree.parse(urlopen('http://www.google.com/search?q=forbidden'))
except HTTPError as e:
root = etree.HTML(e.read())
h1 = root.xpath('//h1')
for h1s in h1:
print h1s.tail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment