Skip to content

Instantly share code, notes, and snippets.

@karschsp
Created August 28, 2012 04:26
Show Gist options
  • Select an option

  • Save karschsp/3494973 to your computer and use it in GitHub Desktop.

Select an option

Save karschsp/3494973 to your computer and use it in GitHub Desktop.
Parse Iron Hill Media beer list
#! /usr/bin/env python
import urllib2 as l2
import lxml.html
import smtplib
from lxml.cssselect import CSSSelector
tappath='//h4[@class="monthly"]'
url = 'http://www.ironhillbrewery.com/media/monthly-releases.htm'
resp = l2.urlopen(url)
data = resp.read()
doc = lxml.html.fromstring(data)
resraw = doc.xpath(tappath)
rawbeers = [x.text_content() for x in resraw]
print rawbeers
beers_str = '\n'.join(rawbeers)
simplebeers = beers_str.encode('ascii', 'ignore')
print(simplebeers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment