on master help sign in
[fix] append http if no scheme is provided in xpath's extact_url

This solves a bug with Yahoo where some results don't specify a protocol.

commit343e555ee96ab8b40b5ed4dce287331685eff3fa authorMarc Abonce Seguin <marc-abonce@mailbox.org> dateSun 8 Apr 2018, 20:35 (9 years ago) parent283f6c9
1 file changed+1−1
searx/engines/xpath.py+1−1
searx/engines/xpath.py+1−1
@@ -53,7 +53,7 @@ def extract_url(xpath_results, search_url):
5353 if url.startswith('//'):
5454 # add http or https to this kind of url //example.com/
5555 parsed_search_url = urlparse(search_url)
56− url = u'{0}:{1}'.format(parsed_search_url.scheme, url)
56+ url = u'{0}:{1}'.format(parsed_search_url.scheme or 'http', url)
5757 elif url.startswith('/'):
5858 # fix relative url to the search engine
5959 url = urljoin(search_url, url)