浏览代码

[fix] skip non-string result url/title/content

Adam Tauber 7 年前
父节点
当前提交
a065fcdcc9
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6
    0
      searx/results.py

+ 6
- 0
searx/results.py 查看文件

@@ -170,10 +170,16 @@ class ResultContainer(object):
170 170
             self.paging = True
171 171
 
172 172
         for i, result in enumerate(results):
173
+            if 'url' in result and not isinstance(result['url'], basestring):
174
+                continue
173 175
             try:
174 176
                 result['url'] = result['url'].decode('utf-8')
175 177
             except:
176 178
                 pass
179
+            if 'title' in result and not isinstance(result['title'], basestring):
180
+                continue
181
+            if 'content' in result and not isinstance(result['content'], basestring):
182
+                continue
177 183
             position = i + 1
178 184
             self._merge_result(result, position)
179 185