Sfoglia il codice sorgente

[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.
Marc Abonce Seguin 6 anni fa
parent
commit
343e555ee9
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1
    1
      searx/engines/xpath.py

+ 1
- 1
searx/engines/xpath.py Vedi File

@@ -53,7 +53,7 @@ def extract_url(xpath_results, search_url):
53 53
     if url.startswith('//'):
54 54
         # add http or https to this kind of url //example.com/
55 55
         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)
57 57
     elif url.startswith('/'):
58 58
         # fix relative url to the search engine
59 59
         url = urljoin(search_url, url)