49def request(query, params):
50 """Assemble request for the SepiaSearch API"""
51
52 if not query:
53 return False
54
55
56 eng_lang = traits.get_language(params['searxng_locale'], None)
57
58 params['url'] = (
59 base_url.rstrip("/")
60 + "/api/v1/search/videos?"
61 + urlencode(
62 {
63 'search': query,
64 'start': (params['pageno'] - 1) * 10,
65 'count': 10,
66
67 'sort': '-match',
68 'nsfw': safesearch_table[params['safesearch']],
69 }
70 )
71 )
72
73 if eng_lang is not None:
74 params['url'] += '&languageOneOf[]=' + eng_lang
75 params['url'] += '&boostLanguages[]=' + eng_lang
76
77 if params['time_range'] in time_range_table:
78 time = datetime.now().date() + time_range_table[params['time_range']]
79 params['url'] += '&startDate=' + time.isoformat()
80
81 return params
82
83