diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2016-07-26 00:22:05 +0200 |
|---|---|---|
| committer | Adam Tauber <asciimoo@gmail.com> | 2016-07-26 00:28:48 +0200 |
| commit | 350a84520d9da2499ffd5b0fbe6218692f2a330d (patch) | |
| tree | 03dd22bea46a817084d782feef8df63f8cd2b375 /searx | |
| parent | 3a8d193d1f746165df35e573f18c7abee970feb0 (diff) | |
[fix] time range detection
Diffstat (limited to 'searx')
| -rw-r--r-- | searx/engines/deviantart.py | 3 | ||||
| -rw-r--r-- | searx/engines/duckduckgo.py | 2 | ||||
| -rw-r--r-- | searx/engines/google.py | 2 | ||||
| -rw-r--r-- | searx/engines/google_images.py | 3 | ||||
| -rw-r--r-- | searx/engines/yahoo.py | 2 |
5 files changed, 5 insertions, 7 deletions
diff --git a/searx/engines/deviantart.py b/searx/engines/deviantart.py index ef1dd9e5f..d893fc7fe 100644 --- a/searx/engines/deviantart.py +++ b/searx/engines/deviantart.py @@ -13,7 +13,6 @@ """ from urllib import urlencode -from urlparse import urljoin from lxml import html import re from searx.engines.xpath import extract_text @@ -39,7 +38,7 @@ def request(query, params): params['url'] = search_url.format(offset=offset, query=urlencode({'q': query})) - if params['time_range']: + if params['time_range'] in time_range_dict: params['url'] += time_range_url.format(range=time_range_dict[params['time_range']]) return params diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py index aa7a98754..2153492e9 100644 --- a/searx/engines/duckduckgo.py +++ b/searx/engines/duckduckgo.py @@ -67,7 +67,7 @@ def request(query, params): params['url'] = url.format( query=urlencode({'q': query}), offset=offset) - if params['time_range']: + if params['time_range'] in time_range_dict: params['url'] += time_range_url.format(range=time_range_dict[params['time_range']]) return params diff --git a/searx/engines/google.py b/searx/engines/google.py index 3b845cbcd..ea93bc94f 100644 --- a/searx/engines/google.py +++ b/searx/engines/google.py @@ -185,7 +185,7 @@ def request(query, params): query=urlencode({'q': query}), hostname=google_hostname, lang=url_lang) - if params['time_range']: + if params['time_range'] in time_range_dict: params['url'] += time_range_search.format(range=time_range_dict[params['time_range']]) params['headers']['Accept-Language'] = language diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py index b687317c8..090d44704 100644 --- a/searx/engines/google_images.py +++ b/searx/engines/google_images.py @@ -11,7 +11,6 @@ """ from urllib import urlencode -from urlparse import parse_qs from json import loads from lxml import html @@ -39,7 +38,7 @@ def request(query, params): params['url'] = search_url.format(query=urlencode({'q': query}), offset=offset, safesearch=safesearch) - if params['time_range']: + if params['time_range'] in time_range_dict: params['url'] += time_range_search.format(range=time_range_dict[params['time_range']]) if safesearch and params['safesearch']: diff --git a/searx/engines/yahoo.py b/searx/engines/yahoo.py index 82f782b9d..8e24a283e 100644 --- a/searx/engines/yahoo.py +++ b/searx/engines/yahoo.py @@ -58,7 +58,7 @@ def parse_url(url_string): def _get_url(query, offset, language, time_range): - if time_range: + if time_range in time_range_dict: return base_url + search_url_with_time.format(offset=offset, query=urlencode({'p': query}), lang=language, |