diff options
| author | Adam Tauber <asciimoo@gmail.com> | 2016-11-01 20:01:51 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-01 20:01:51 +0100 |
| commit | e23c8f954b6ae0f1100167d39b73e2037384c154 (patch) | |
| tree | 87547b424edec417b3306e84c92bae1af5ede295 /searx/engines/bing_images.py | |
| parent | 6243639f013b18fbdf6d667895f32fda6048d8f8 (diff) | |
| parent | 1490d6bc939a59458a6ae9a56045064a3fc8b7a4 (diff) | |
Merge pull request #746 from kvch/moar-time-range-support
Support time range search in more engines
Diffstat (limited to 'searx/engines/bing_images.py')
| -rw-r--r-- | searx/engines/bing_images.py | 7 |
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 |