2
from html5lib import treebuilders
3
from cStringIO import StringIO
5
# Hack, hide DataLossWarnings
6
# Based on html5lib code namespaceHTMLElements=False should do it, but nope ...
7
# Also it doesn't seem to be available in older version from html5lib, removing it
9
from html5lib.constants import DataLossWarning
10
warnings.simplefilter('ignore', DataLossWarning)
14
if isinstance(obj, basestring):
16
parser = html5lib.HTMLParser(tree=treebuilders.getTreeBuilder('beautifulsoup'))
17
return parser.parse(obj)