瀏覽代碼

Merge pull request #405 from pointhi/bug_fixes

some Bug fixes
Adam Tauber 9 年之前
父節點
當前提交
c43476229b
共有 3 個文件被更改,包括 14 次插入2 次删除
  1. 1
    1
      searx/__init__.py
  2. 9
    1
      searx/engines/startpage.py
  3. 4
    0
      searx/search.py

+ 1
- 1
searx/__init__.py 查看文件

@@ -40,7 +40,7 @@ else:
40 40
 with open(settings_path) as settings_yaml:
41 41
     settings = load(settings_yaml)
42 42
 
43
-if settings.get('server', {}).get('debug'):
43
+if settings.get('general', {}).get('debug'):
44 44
     logging.basicConfig(level=logging.DEBUG)
45 45
 else:
46 46
     logging.basicConfig(level=logging.WARNING)

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

@@ -66,7 +66,15 @@ def response(resp):
66 66
         url = link.attrib.get('href')
67 67
 
68 68
         # block google-ad url's
69
-        if re.match("^http(s|)://www.google.[a-z]+/aclk.*$", url):
69
+        if re.match("^http(s|)://(www\.)?google\.[a-z]+/aclk.*$", url):
70
+            continue
71
+
72
+        # block startpage search url's
73
+        if re.match("^http(s|)://(www\.)?startpage\.com/do/search\?.*$", url):
74
+            continue
75
+
76
+        # block ixquick search url's
77
+        if re.match("^http(s|)://(www\.)?ixquick\.com/do/search\?.*$", url):
70 78
             continue
71 79
 
72 80
         title = escape(extract_text(link))

+ 4
- 0
searx/search.py 查看文件

@@ -206,6 +206,10 @@ def score_results(results):
206 206
         # if there is no duplicate found, append result
207 207
         else:
208 208
             res['score'] = score
209
+            # if the result has no scheme, use http as default
210
+            if res['parsed_url'].scheme == '':
211
+                res['parsed_url'] = res['parsed_url']._replace(scheme="http")
212
+
209 213
             results.append(res)
210 214
 
211 215
     results = sorted(results, key=itemgetter('score'), reverse=True)