浏览代码

[fix] handling missing github descriptions

asciimoo 11 年前
父节点
当前提交
708fa6f88a
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4
    1
      searx/engines/github.py

+ 4
- 1
searx/engines/github.py 查看文件

21
     for res in search_res['items']:
21
     for res in search_res['items']:
22
         title = res['name']
22
         title = res['name']
23
         url = res['html_url']
23
         url = res['html_url']
24
-        content = escape(res['description'][:500])
24
+        if res['description']:
25
+            content = escape(res['description'][:500])
26
+        else:
27
+            content = ''
25
         results.append({'url': url, 'title': title, 'content': content})
28
         results.append({'url': url, 'title': title, 'content': content})
26
     return results
29
     return results