diff options
Diffstat (limited to 'searx/engines/dailymotion.py')
-rw-r--r-- | searx/engines/dailymotion.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/searx/engines/dailymotion.py b/searx/engines/dailymotion.py index 317f34f59..8c69aafe0 100644 --- a/searx/engines/dailymotion.py +++ b/searx/engines/dailymotion.py @@ -15,6 +15,7 @@ from urllib import urlencode from json import loads from datetime import datetime +from requests import get # engine dependent config categories = ['videos'] @@ -27,6 +28,8 @@ search_url = 'https://api.dailymotion.com/videos?fields=created_time,title,descr embedded_url = '<iframe frameborder="0" width="540" height="304" ' +\ 'data-src="//www.dailymotion.com/embed/video/{videoid}" allowfullscreen></iframe>' +supported_languages_url = 'https://api.dailymotion.com/languages' + # do search-request def request(query, params): @@ -74,3 +77,22 @@ def response(resp): # return results return results + + +# get supported languages from their site +def _fetch_supported_languages(resp): + supported_languages = {} + + response_json = loads(resp.text) + + for language in response_json['list']: + supported_languages[language['code']] = {} + + name = language['native_name'] + if name: + supported_languages[language['code']]['name'] = name + english_name = language['name'] + if english_name: + supported_languages[language['code']]['english_name'] = english_name + + return supported_languages |