浏览代码

Merge pull request #44 from potato/master

[fix] xpath_results in extract_text
Adam Tauber 11 年前
父节点
当前提交
e86947d79c
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      searx/engines/xpath.py

+ 2
- 2
searx/engines/xpath.py 查看文件

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