Browse Source

[fix] add missing scheme to duplicated results too ++ revert gigablasts handling

Adam Tauber 9 years ago
parent
commit
37c3ace309
2 changed files with 4 additions and 5 deletions
  1. 0
    2
      searx/engines/gigablast.py
  2. 4
    3
      searx/search.py

+ 0
- 2
searx/engines/gigablast.py View File

@@ -53,8 +53,6 @@ def response(resp):
53 53
     # parse results
54 54
     for result in dom.xpath(results_xpath):
55 55
         url = result.xpath(url_xpath)[0].text
56
-        if not url.startswith('http://') and not url.startswith('https://'):
57
-            url = 'http://' + url
58 56
         title = result.xpath(title_xpath)[0].text
59 57
         content = escape(result.xpath(content_xpath)[0].text)
60 58
 

+ 4
- 3
searx/search.py View File

@@ -143,6 +143,10 @@ def score_results(results):
143 143
 
144 144
         res['parsed_url'] = urlparse(res['url'])
145 145
 
146
+        # if the result has no scheme, use http as default
147
+        if not res['parsed_url'].scheme:
148
+            res['parsed_url'] = res['parsed_url']._replace(scheme="http")
149
+
146 150
         res['host'] = res['parsed_url'].netloc
147 151
 
148 152
         if res['host'].startswith('www.'):
@@ -206,9 +210,6 @@ def score_results(results):
206 210
         # if there is no duplicate found, append result
207 211
         else:
208 212
             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 213
 
213 214
             results.append(res)
214 215