summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorNoémi Ványi <sitbackandwait@gmail.com>2016-10-30 20:58:34 +0100
committerNoémi Ványi <sitbackandwait@gmail.com>2016-11-01 17:58:29 +0100
commit5c02b9ef3113feaf8e98621970f7836a74376c23 (patch)
tree6fe2f6fa9ac849021eb572b5e360a97610598df9 /searx/engines
parentd2e0cbafb265594a23389fe58b7889ff088560f6 (diff)
downloadsearxng-5c02b9ef3113feaf8e98621970f7836a74376c23.tar.gz
searxng-5c02b9ef3113feaf8e98621970f7836a74376c23.zip
add time range support for bing images
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/bing_images.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/searx/engines/bing_images.py b/searx/engines/bing_images.py
index 384520392..417871d6f 100644
--- a/searx/engines/bing_images.py
+++ b/searx/engines/bing_images.py
@@ -24,11 +24,16 @@ import re
categories = ['images']
paging = True
safesearch = True
+time_range_support = True
# search-url
base_url = 'https://www.bing.com/'
search_string = 'images/search?{query}&count=10&first={offset}'
+time_range_string = '&qft=+filterui:age-lt{interval}'
thumb_url = "https://www.bing.com/th?id={ihk}"
+time_range_dict = {'day': '1440',
+ 'week': '10080',
+ 'month': '43200'}
# safesearch definitions
safesearch_types = {2: 'STRICT',
@@ -58,6 +63,8 @@ def request(query, params):
'&ADLT=' + safesearch_types.get(params['safesearch'], 'DEMOTE')
params['url'] = base_url + search_path
+ if params['time_range'] in time_range_dict:
+ params['url'] += time_range_string.format(interval=time_range_dict[params['time_range']])
return params