summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorNoemi Vanyi <sitbackandwait@gmail.com>2016-07-18 17:25:40 +0200
committerNoemi Vanyi <sitbackandwait@gmail.com>2016-07-25 23:28:14 +0200
commite9a78f1434806df7235f575db3d3267b5ae852fe (patch)
tree5986316193be416a9f9b830e311d110cc67409eb /searx/engines
parentf13b9fa36ae51861b8c5a1e110895af0f8c5f555 (diff)
downloadsearxng-e9a78f1434806df7235f575db3d3267b5ae852fe.tar.gz
searxng-e9a78f1434806df7235f575db3d3267b5ae852fe.zip
add time range search for google images
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/google_images.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py
index efe46812a..eab0fba08 100644
--- a/searx/engines/google_images.py
+++ b/searx/engines/google_images.py
@@ -19,13 +19,17 @@ from lxml import html
categories = ['images']
paging = True
safesearch = True
+time_range_support = True
search_url = 'https://www.google.com/search'\
'?{query}'\
'&tbm=isch'\
'&ijn=1'\
'&start={offset}'
-
+time_range_search = "&tbs=qdr:{range}"
+time_range_dict = {'day': 'd',
+ 'week': 'w',
+ 'month': 'm'}
# do search-request
def request(query, params):
@@ -34,6 +38,8 @@ def request(query, params):
params['url'] = search_url.format(query=urlencode({'q': query}),
offset=offset,
safesearch=safesearch)
+ if params['time_range']:
+ params['url'] += time_range_search.format(range=time_range_dict[params['time_range']])
if safesearch and params['safesearch']:
params['url'] += '&' + urlencode({'safe': 'active'})