mirror of
https://github.com/taroved/pol
synced 2025-05-29 04:20:09 -07:00
html2json hotfix
This commit is contained in:
parent
10931178d6
commit
b0881ce375
@ -47,13 +47,13 @@ def html2json(el):
|
|||||||
return [
|
return [
|
||||||
el.tag,
|
el.tag,
|
||||||
{"tag-id": el.attrib["tag-id"]},
|
{"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):
|
def setBaseAndRemoveScriptsAndMore(response, url):
|
||||||
response.selector.remove_namespaces()
|
response.selector.remove_namespaces()
|
||||||
|
|
||||||
tree = response.selector._root.getroottree()
|
tree = response.selector.root.getroottree()
|
||||||
|
|
||||||
# set base url to html document
|
# set base url to html document
|
||||||
head = tree.xpath("//head")
|
head = tree.xpath("//head")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user