on master help sign in
[fix] error when xpath_results in extraxt_text is _ElementUnicodeResult instead of _ElementStringResult
commit6f535b6fae878c1fb8520c944156c7dc4b81228d authorpotato <mail@crazypotato.tk> dateTue 4 Mar 2014, 19:43 (13 years ago) parent693415c
1 file changed+2−2
searx/engines/xpath.py+2−2
searx/engines/xpath.py+2−2
@@ -1,7 +1,7 @@
11from lxml import html
22from urllib import urlencode, unquote
33from urlparse import urlparse, urljoin
4−from lxml.etree import _ElementStringResult
4+from lxml.etree import _ElementStringResult, _ElementUnicodeResult
55from searx.utils import html_to_text
66
77search_url = None
@@ -29,7 +29,7 @@ def extract_text(xpath_results):
2929 for e in xpath_results:
3030 result = result + extract_text(e)
3131 return result
32− elif type(xpath_results) == _ElementStringResult:
32+ elif type(xpath_results) in [_ElementStringResult, _ElementUnicodeResult]:
3333 # it's a string
3434 return ''.join(xpath_results)
3535 else: