v/pol
1
0
mirror of https://github.com/taroved/pol synced 2025-05-29 04:20:09 -07:00

html2json hotfix

This commit is contained in:
Alexandr Nesterenko 2017-07-23 12:59:15 -07:00
parent 10931178d6
commit b0881ce375

View File

@ -47,13 +47,13 @@ def html2json(el):
return [
el.tag,
{"tag-id": el.attrib["tag-id"]},
[html2json(e) for e in el.getchildren() if type(e) == etree._Element]
[html2json(e) for e in el.getchildren() if isinstance(e, etree._Element)]
]
def setBaseAndRemoveScriptsAndMore(response, url):
response.selector.remove_namespaces()
tree = response.selector._root.getroottree()
tree = response.selector.root.getroottree()
# set base url to html document
head = tree.xpath("//head")