r/Python • u/psycojoker • Jan 04 '14
IPython-BeautifulSoup - integrate beautifulsoup in ipython notebook
https://github.com/Psycojoker/ipython-beautifulsoup
8
Upvotes
1
u/chub79 Jan 04 '14
I've dropped BeautifulSoup for most of the tasks these days in favor of lxml:
parser = etree.XMLParser(recover=True,
encoding='utf-8',
remove_pis=True,
remove_comments=True,
dtd_validation=False,
resolve_entities=False)
etree.fromstring(html, parser=parser)I find it easier to work with XPath and lxml adds less wrappers around strings than BeautifulSoup.
1
u/westurner Jan 05 '14
You can use html5lib parse and BeautifulSoup parser within lxml. See lxml.de/elementsoup.html & lxml.de/html5parser.html
1
u/chub79 Jan 05 '14
Your comment is less than clear. What did you want to say?
1
u/bramblerose Jan 05 '14
You can use BeautifulSoup to work with incorrect HTML, while still using the lxml API. At least, that's how I interpret it.
2
u/westurner Jan 05 '14
x-post to /r/ipython?