summaryrefslogtreecommitdiff
path: root/searx/engines/xpath.py
diff options
context:
space:
mode:
authorNoémi Ványi <kvch@users.noreply.github.com>2020-09-12 14:51:35 +0200
committerGitHub <noreply@github.com>2020-09-12 14:51:35 +0200
commit2370234d0978f59dd62efa4a4931e41ad31444d1 (patch)
treed3863e22b3d34092484146ce0bdc6e0ca8d36216 /searx/engines/xpath.py
parent272158944bf13503e2597018fc60a00baddec660 (diff)
parentbdac99d4f0349a71d7ecb9a4c61687356afedd6b (diff)
Merge pull request #2137 from dalf/drop-python-2
Drop Python 2
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