mirror of https://github.com/searxng/searxng.git
[enh] dailymotion engine: add language support
This commit is contained in:
parent
c23db1b2bf
commit
7f1e2ba211
|
@ -16,8 +16,8 @@ from lxml import html
|
||||||
|
|
||||||
# engine dependent config
|
# engine dependent config
|
||||||
categories = ['videos']
|
categories = ['videos']
|
||||||
locale = 'en_US'
|
|
||||||
paging = True
|
paging = True
|
||||||
|
language_support = True
|
||||||
|
|
||||||
# search-url
|
# search-url
|
||||||
# see http://www.dailymotion.com/doc/api/obj-video.html
|
# see http://www.dailymotion.com/doc/api/obj-video.html
|
||||||
|
@ -26,6 +26,11 @@ search_url = 'https://api.dailymotion.com/videos?fields=title,description,durati
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
|
if params['language'] == 'all':
|
||||||
|
locale = 'en-US'
|
||||||
|
else:
|
||||||
|
locale = params['language']
|
||||||
|
|
||||||
params['url'] = search_url.format(
|
params['url'] = search_url.format(
|
||||||
query=urlencode({'search': query, 'localization': locale}),
|
query=urlencode({'search': query, 'localization': locale}),
|
||||||
pageno=params['pageno'])
|
pageno=params['pageno'])
|
||||||
|
|
Loading…
Reference in New Issue