[FIX] tools: lxml.etree.XMLSyntaxError if html is empty

Don't try to parse html as xml if html is empty
This commit is contained in:
Jeremy Kersten
2015-08-27 18:13:11 +02:00
parent 46de6789c6
commit 436daf0c4f
+4
View File
@@ -475,6 +475,10 @@ def html2plaintext(html, body_id=None, encoding='utf-8'):
## download here: http://www.peterbe.com/plog/html2plaintext
html = ustr(html)
if not html:
return ''
tree = etree.fromstring(html, parser=etree.HTMLParser())
if body_id is not None: