All pastes #57889 Raw Edit

Parser

public python v1 · immutable
#57889 ·published 2006-05-22 04:24 UTC
rendered paste body
import urllibimport htmllibimport formatterclass DigiumPageParser(htmllib.HTMLParser):	def __init__(self):		htmllib.HTMLParser.__init__(self, formatter.NullFormatter(), 0)		self.enlace = False	def start_a(self, attributes):		if dict(attributes).get('class') == 'descriptiontext':			self.enlace = True	def end_a(self):		self.enlace = False	def handle_data(self, data):		if self.enlace:			print dataif __name__ == '__main__':	parser = DigiumPageParser()	archivo = urllib.urlopen('http://www.voipsupply.com/index.php?ref=voip-supply&manufacturers_id=13')	parser.feed(archivo.read())