summaryrefslogtreecommitdiff
path: root/searx/engines/google_images.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2016-07-26 00:06:16 +0200
committerGitHub <noreply@github.com>2016-07-26 00:06:16 +0200
commit7d9c898170df497036b8a7a70a1a5c86c3859670 (patch)
treeca1722a5d0d1bc8493e50bd334a07ea50e744e63 /searx/engines/google_images.py
parent54d987636e4b03d19a99ad9d143bf63b119af208 (diff)
parent90e74fbb288b2f1df0516d877d3bd239c7800412 (diff)
Merge pull request #634 from kvch/advanced-search
support time range search
Diffstat (limited to 'searx/engines/google_images.py')
-rw-r--r--searx/engines/google_images.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py
index efe46812a..b687317c8 100644
--- a/searx/engines/google_images.py
+++ b/searx/engines/google_images.py
@@ -19,12 +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
@@ -34,6 +39,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'})