summaryrefslogtreecommitdiff
path: root/searx/engines/xpath.py
diff options
context:
space:
mode:
authorDalf <alex@al-f.net>2020-08-06 17:42:46 +0200
committerAlexandre Flament <alex@al-f.net>2020-09-10 10:39:04 +0200
commit1022228d950c2a809ed613df1a515d9a6cafda7c (patch)
treed792dddea1a5b278b018ed4e024cd13340d5c1b1 /searx/engines/xpath.py
parent272158944bf13503e2597018fc60a00baddec660 (diff)
Drop Python 2 (1/n): remove unicode string and url_utils
Diffstat (limited to 'searx/engines/xpath.py')
-rw-r--r--searx/engines/xpath.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py
index a9f3e4bdd..bd97a93a5 100644
--- a/searx/engines/xpath.py
+++ b/searx/engines/xpath.py
@@ -1,7 +1,7 @@
+from urllib.parse import unquote, urlencode, urljoin, urlparse
from lxml import html
from lxml.etree import _ElementStringResult, _ElementUnicodeResult
from searx.utils import html_to_text, eval_xpath
-from searx.url_utils import unquote, urlencode, urljoin, urlparse
search_url = None
url_xpath = None
@@ -56,7 +56,7 @@ def extract_url(xpath_results, search_url):
if url.startswith('//'):
# add http or https to this kind of url //example.com/
parsed_search_url = urlparse(search_url)
- url = u'{0}:{1}'.format(parsed_search_url.scheme or 'http', url)
+ url = '{0}:{1}'.format(parsed_search_url.scheme or 'http', url)
elif url.startswith('/'):
# fix relative url to the search engine
url = urljoin(search_url, url)
@@ -86,7 +86,7 @@ def normalize_url(url):
p = parsed_url.path
mark = p.find('/**')
if mark != -1:
- return unquote(p[mark + 3:]).decode('utf-8')
+ return unquote(p[mark + 3:]).decode()
return url