[enh] dailymotion engine: add language support

This commit is contained in:
Dalf 2014-09-07 17:14:42 +02:00
parent c23db1b2bf
commit 7f1e2ba211
1 changed files with 6 additions and 1 deletions

View File

@ -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'])