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
     # parse results
53
     # parse results
54
     for result in dom.xpath(results_xpath):
54
     for result in dom.xpath(results_xpath):
55
         url = result.xpath(url_xpath)[0].text
55
         url = result.xpath(url_xpath)[0].text
56
-        if not url.startswith('http://') and not url.startswith('https://'):
57
-            url = 'http://' + url
58
         title = result.xpath(title_xpath)[0].text
56
         title = result.xpath(title_xpath)[0].text
59
         content = escape(result.xpath(content_xpath)[0].text)
57
         content = escape(result.xpath(content_xpath)[0].text)
60
 
58
 

+ 4
- 3
searx/search.py View File

143
 
143
 
144
         res['parsed_url'] = urlparse(res['url'])
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
         res['host'] = res['parsed_url'].netloc
150
         res['host'] = res['parsed_url'].netloc
147
 
151
 
148
         if res['host'].startswith('www.'):
152
         if res['host'].startswith('www.'):
206
         # if there is no duplicate found, append result
210
         # if there is no duplicate found, append result
207
         else:
211
         else:
208
             res['score'] = score
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
             results.append(res)
214
             results.append(res)
214
 
215