XPath RegularExpression support

pull/435/head
Michael 3 years ago committed by GitHub
parent a0e4f9b88a
commit 85715120e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -25,7 +25,7 @@ def xpath_filter(xpath_filter, html_content):
tree = html.fromstring(html_content)
html_block = ""
for item in tree.xpath(xpath_filter.strip()):
for item in tree.xpath(xpath_filter.strip(), namespaces={'re':'http://exslt.org/regular-expressions'}):
html_block+= etree.tostring(item, pretty_print=True).decode('utf-8')+"<br/>"
return html_block

Loading…
Cancel
Save