瀏覽代碼

[mod] ignore startpage unicode errors

Adam Tauber 10 年之前
父節點
當前提交
c8be128e97
共有 1 個檔案被更改,包括 4 行新增1 行删除
  1. 4
    1
      searx/engines/startpage.py

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

@@ -66,7 +66,10 @@ def response(resp):
66 66
             continue
67 67
         link = links[0]
68 68
         url = link.attrib.get('href')
69
-        title = escape(link.text_content())
69
+        try:
70
+            title = escape(link.text_content())
71
+        except UnicodeDecodeError:
72
+            continue
70 73
 
71 74
         # block google-ad url's
72 75
         if re.match("^http(s|)://www.google.[a-z]+/aclk.*$", url):