[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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user