ソースを参照

add time range search for deviantart

Noemi Vanyi 8 年 前
コミット
e7baf24ec1
共有1 個のファイルを変更した8 個の追加0 個の削除を含む
  1. 8
    0
      searx/engines/deviantart.py

+ 8
- 0
searx/engines/deviantart.py ファイルの表示

21
 # engine dependent config
21
 # engine dependent config
22
 categories = ['images']
22
 categories = ['images']
23
 paging = True
23
 paging = True
24
+time_range_support = True
24
 
25
 
25
 # search-url
26
 # search-url
26
 base_url = 'https://www.deviantart.com/'
27
 base_url = 'https://www.deviantart.com/'
27
 search_url = base_url + 'browse/all/?offset={offset}&{query}'
28
 search_url = base_url + 'browse/all/?offset={offset}&{query}'
29
+time_range_url = '&order={range}'
30
+
31
+time_range_dict = {'day': 11,
32
+                   'week': 14,
33
+                   'month': 15}
28
 
34
 
29
 
35
 
30
 # do search-request
36
 # do search-request
33
 
39
 
34
     params['url'] = search_url.format(offset=offset,
40
     params['url'] = search_url.format(offset=offset,
35
                                       query=urlencode({'q': query}))
41
                                       query=urlencode({'q': query}))
42
+    if params['time_range']:
43
+        params['url'] += time_range_url.format(range=time_range_dict[params['time_range']])
36
 
44
 
37
     return params
45
     return params
38
 
46