summaryrefslogtreecommitdiff
path: root/searx/engines/deviantart.py
diff options
context:
space:
mode:
authorNoemi Vanyi <sitbackandwait@gmail.com>2016-07-19 10:06:47 +0200
committerNoemi Vanyi <sitbackandwait@gmail.com>2016-07-25 23:28:14 +0200
commite7baf24ec16366da000dc37b7e9e4377138ee0a2 (patch)
treefbe098e4eacbd2285e4b270136f21d837243e4b6 /searx/engines/deviantart.py
parente9a78f1434806df7235f575db3d3267b5ae852fe (diff)
downloadsearxng-e7baf24ec16366da000dc37b7e9e4377138ee0a2.tar.gz
searxng-e7baf24ec16366da000dc37b7e9e4377138ee0a2.zip
add time range search for deviantart
Diffstat (limited to 'searx/engines/deviantart.py')
-rw-r--r--searx/engines/deviantart.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/searx/engines/deviantart.py b/searx/engines/deviantart.py
index 70761370c..ef1dd9e5f 100644
--- a/searx/engines/deviantart.py
+++ b/searx/engines/deviantart.py
@@ -21,10 +21,16 @@ from searx.engines.xpath import extract_text
# engine dependent config
categories = ['images']
paging = True
+time_range_support = True
# search-url
base_url = 'https://www.deviantart.com/'
search_url = base_url + 'browse/all/?offset={offset}&{query}'
+time_range_url = '&order={range}'
+
+time_range_dict = {'day': 11,
+ 'week': 14,
+ 'month': 15}
# do search-request
@@ -33,6 +39,8 @@ def request(query, params):
params['url'] = search_url.format(offset=offset,
query=urlencode({'q': query}))
+ if params['time_range']:
+ params['url'] += time_range_url.format(range=time_range_dict[params['time_range']])
return params