diff options
Diffstat (limited to 'searx/plugins')
-rw-r--r-- | searx/plugins/__init__.py | 5 | ||||
-rw-r--r-- | searx/plugins/doai_rewrite.py | 2 | ||||
-rw-r--r-- | searx/plugins/https_rewrite.py | 5 | ||||
-rw-r--r-- | searx/plugins/self_info.py | 4 | ||||
-rw-r--r-- | searx/plugins/tracker_url_remover.py | 2 |
5 files changed, 12 insertions, 6 deletions
diff --git a/searx/plugins/__init__.py b/searx/plugins/__init__.py index 011d3626..46c1f891 100644 --- a/searx/plugins/__init__.py +++ b/searx/plugins/__init__.py @@ -14,9 +14,12 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. (C) 2015 by Adam Tauber, <asciimoo@gmail.com> ''' -from sys import exit +from sys import exit, version_info from searx import logger +if version_info[0] == 3: + unicode = str + logger = logger.getChild('plugins') from searx.plugins import (doai_rewrite, diff --git a/searx/plugins/doai_rewrite.py b/searx/plugins/doai_rewrite.py index a6e15ae5..95efa8f9 100644 --- a/searx/plugins/doai_rewrite.py +++ b/searx/plugins/doai_rewrite.py @@ -1,6 +1,6 @@ from flask_babel import gettext import re -from urlparse import urlparse, parse_qsl +from searx.url_utils import urlparse, parse_qsl regex = re.compile(r'10\.\d{4,9}/[^\s]+') diff --git a/searx/plugins/https_rewrite.py b/searx/plugins/https_rewrite.py index 8b4c9784..4462c86b 100644 --- a/searx/plugins/https_rewrite.py +++ b/searx/plugins/https_rewrite.py @@ -16,14 +16,17 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. ''' import re -from urlparse import urlparse +import sys from lxml import etree from os import listdir, environ from os.path import isfile, isdir, join from searx.plugins import logger from flask_babel import gettext from searx import searx_dir +from searx.url_utils import urlparse +if sys.version_info[0] == 3: + unicode = str name = "HTTPS rewrite" description = gettext('Rewrite HTTP links to HTTPS if possible') diff --git a/searx/plugins/self_info.py b/searx/plugins/self_info.py index a2aeda98..8d6c661a 100644 --- a/searx/plugins/self_info.py +++ b/searx/plugins/self_info.py @@ -22,7 +22,7 @@ default_on = True # Self User Agent regex -p = re.compile('.*user[ -]agent.*', re.IGNORECASE) +p = re.compile(b'.*user[ -]agent.*', re.IGNORECASE) # attach callback to the post search hook @@ -31,7 +31,7 @@ p = re.compile('.*user[ -]agent.*', re.IGNORECASE) def post_search(request, search): if search.search_query.pageno > 1: return True - if search.search_query.query == 'ip': + if search.search_query.query == b'ip': x_forwarded_for = request.headers.getlist("X-Forwarded-For") if x_forwarded_for: ip = x_forwarded_for[0] diff --git a/searx/plugins/tracker_url_remover.py b/searx/plugins/tracker_url_remover.py index 68a004e3..a8401282 100644 --- a/searx/plugins/tracker_url_remover.py +++ b/searx/plugins/tracker_url_remover.py @@ -17,7 +17,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. from flask_babel import gettext import re -from urlparse import urlunparse +from searx.url_utils import urlunparse regexes = {re.compile(r'utm_[^&]+&?'), re.compile(r'(wkey|wemail)[^&]+&?'), |