on master help sign in
[fix] add missing scheme to duplicated results too ++ revert gigablasts handling
commit37c3ace3096d9568f8dbdc3728659f4c77377b33 authorAdam Tauber <asciimoo@gmail.com> dateFri 11 Sep 2015, 18:33 (11 years ago) parente3df22b
2 files changed+4−5
searx/engines/gigablast.py−2 searx/search.py+4−3
searx/engines/gigablast.py−2
@@ -53,8 +53,6 @@ def response(resp):
5353 # parse results
5454 for result in dom.xpath(results_xpath):
5555 url = result.xpath(url_xpath)[0].text
56− if not url.startswith('http://') and not url.startswith('https://'):
57− url = 'http://' + url
5856 title = result.xpath(title_xpath)[0].text
5957 content = escape(result.xpath(content_xpath)[0].text)
6058
searx/search.py+4−3
@@ -143,6 +143,10 @@ def score_results(results):
143143
144144 res['parsed_url'] = urlparse(res['url'])
145145
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+
146150 res['host'] = res['parsed_url'].netloc
147151
148152 if res['host'].startswith('www.'):
@@ -206,9 +210,6 @@ def score_results(results):
206210 # if there is no duplicate found, append result
207211 else:
208212 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")
212213
213214 results.append(res)
214215