|
@@ -17,10 +17,15 @@ from searx.utils import list_get
|
17
|
17
|
categories = ['videos', 'music']
|
18
|
18
|
paging = True
|
19
|
19
|
language_support = False
|
|
20
|
+time_range_support = True
|
20
|
21
|
|
21
|
22
|
# search-url
|
22
|
23
|
base_url = 'https://www.youtube.com/results'
|
23
|
24
|
search_url = base_url + '?search_query={query}&page={page}'
|
|
25
|
+time_range_url = '&sp=EgII{time_range}%253D%253D'
|
|
26
|
+time_range_dict = {'day': 'Ag',
|
|
27
|
+ 'week': 'Aw',
|
|
28
|
+ 'month': 'BA'}
|
24
|
29
|
|
25
|
30
|
embedded_url = '<iframe width="540" height="304" ' +\
|
26
|
31
|
'data-src="//www.youtube-nocookie.com/embed/{videoid}" ' +\
|
|
@@ -47,6 +52,8 @@ def extract_text_from_dom(result, xpath):
|
47
|
52
|
def request(query, params):
|
48
|
53
|
params['url'] = search_url.format(query=quote_plus(query),
|
49
|
54
|
page=params['pageno'])
|
|
55
|
+ if params['time_range'] in time_range_dict:
|
|
56
|
+ params['url'] += time_range_url.format(time_range=time_range_dict[params['time_range']])
|
50
|
57
|
|
51
|
58
|
return params
|
52
|
59
|
|