Use etree.tostring 'method' arg

Gives appropriately formatted html code.
Some pages might otherwise be rendered as blank.
This commit is contained in:
2020-05-13 11:44:34 +02:00
parent 7d0d416610
commit 22005065e8
3 changed files with 6 additions and 6 deletions

View File

@@ -341,7 +341,7 @@ def get_article(data, url=None, encoding_in=None, encoding_out='unicode', debug=
if url:
best.make_links_absolute(url)
return lxml.etree.tostring(best if not debug else html, pretty_print=True, encoding=encoding_out)
return lxml.etree.tostring(best if not debug else html, method='html', encoding=encoding_out)
if __name__ == '__main__':