on master help sign in
Merge pull request #44 from potato/master

[fix] xpath_results in extract_text

commite86947d79c0c1b380e718bc06072285e8a6ca8ed authorAdam Tauber <asciimoo@gmail.com> dateTue 4 Mar 2014, 19:47 (13 years ago) parent693415c6f535b6
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: