Преглед на файлове

[fix] error when xpath_results in extraxt_text is _ElementUnicodeResult instead of _ElementStringResult

potato преди 11 години
родител
ревизия
6f535b6fae
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2
    2
      searx/engines/xpath.py

+ 2
- 2
searx/engines/xpath.py Целия файл

1
 from lxml import html
1
 from lxml import html
2
 from urllib import urlencode, unquote
2
 from urllib import urlencode, unquote
3
 from urlparse import urlparse, urljoin
3
 from urlparse import urlparse, urljoin
4
-from lxml.etree import _ElementStringResult
4
+from lxml.etree import _ElementStringResult, _ElementUnicodeResult
5
 from searx.utils import html_to_text
5
 from searx.utils import html_to_text
6
 
6
 
7
 search_url = None
7
 search_url = None
29
         for e in xpath_results:
29
         for e in xpath_results:
30
             result = result + extract_text(e)
30
             result = result + extract_text(e)
31
         return result
31
         return result
32
-    elif type(xpath_results) == _ElementStringResult:
32
+    elif type(xpath_results) in [_ElementStringResult, _ElementUnicodeResult]:
33
         # it's a string
33
         # it's a string
34
         return ''.join(xpath_results)
34
         return ''.join(xpath_results)
35
     else:
35
     else: