1
0
mirror of https://github.com/searx/searx synced 2024-11-12 05:49:13 +01:00

Merge pull request #44 from potato/master

[fix] xpath_results in extract_text
This commit is contained in:
Adam Tauber 2014-03-04 19:47:24 +01:00
commit e86947d79c

View File

@ -1,7 +1,7 @@
from lxml import html
from urllib import urlencode, unquote
from urlparse import urlparse, urljoin
from lxml.etree import _ElementStringResult
from lxml.etree import _ElementStringResult, _ElementUnicodeResult
from searx.utils import html_to_text
search_url = None
@ -29,7 +29,7 @@ def extract_text(xpath_results):
for e in xpath_results:
result = result + extract_text(e)
return result
elif type(xpath_results) == _ElementStringResult:
elif type(xpath_results) in [_ElementStringResult, _ElementUnicodeResult]:
# it's a string
return ''.join(xpath_results)
else: