[telequebec] Fix issues (closes #26368)

This commit is contained in:
Sergey M․ 2020-09-19 07:52:42 +07:00
parent b856b3997c
commit 82ef02e936
No known key found for this signature in database
GPG Key ID: 2C393E0F18A9236D

View File

@ -12,23 +12,24 @@
class TeleQuebecBaseIE(InfoExtractor): class TeleQuebecBaseIE(InfoExtractor):
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/6150020952001/default_default/index.html?videoId=%s' @staticmethod
def _result(url, ie_key):
return {
'_type': 'url_transparent',
'url': smuggle_url(url, {'geo_countries': ['CA']}),
'ie_key': ie_key,
}
@staticmethod @staticmethod
def _limelight_result(media_id): def _limelight_result(media_id):
return { return TeleQuebecBaseIE._result(
'_type': 'url_transparent', 'limelight:media:' + media_id, 'LimelightMedia')
'url': smuggle_url(
'limelight:media:' + media_id, {'geo_countries': ['CA']}),
'ie_key': 'LimelightMedia',
}
def _brightcove_result(self, brightcove_id): @staticmethod
return self.url_result( def _brightcove_result(brightcove_id):
smuggle_url( return TeleQuebecBaseIE._result(
self.BRIGHTCOVE_URL_TEMPLATE % brightcove_id, 'http://players.brightcove.net/6150020952001/default_default/index.html?videoId=%s'
{'geo_countries': ['CA']}), % brightcove_id, 'BrightcoveNew')
'BrightcoveNew', brightcove_id)
class TeleQuebecIE(TeleQuebecBaseIE): class TeleQuebecIE(TeleQuebecBaseIE):
@ -51,6 +52,22 @@ class TeleQuebecIE(TeleQuebecBaseIE):
'params': { 'params': {
'skip_download': True, 'skip_download': True,
}, },
}, {
'url': 'https://zonevideo.telequebec.tv/media/55267/le-soleil/passe-partout',
'info_dict': {
'id': '6167180337001',
'ext': 'mp4',
'title': 'Le soleil',
'description': 'md5:64289c922a8de2abbe99c354daffde02',
'uploader_id': '6150020952001',
'upload_date': '20200625',
'timestamp': 1593090307,
},
'params': {
'format': 'bestvideo',
'skip_download': True,
},
'add_ie': ['BrightcoveNew'],
}, { }, {
# no description # no description
'url': 'http://zonevideo.telequebec.tv/media/30261', 'url': 'http://zonevideo.telequebec.tv/media/30261',
@ -67,10 +84,14 @@ def _real_extract(self, url):
'https://mnmedias.api.telequebec.tv/api/v2/media/' + media_id, 'https://mnmedias.api.telequebec.tv/api/v2/media/' + media_id,
media_id)['media'] media_id)['media']
if media_data['streamInfo']['source'] == 'Brightcove': source_id = media_data['streamInfo']['sourceId']
info = self._brightcove_result(media_data['streamInfo']['sourceId']) source = (try_get(
elif media_data['streamInfo']['source'] == 'Limelight': media_data, lambda x: x['streamInfo']['source'],
info = self._limelight_result(media_data['streamInfo']['sourceId']) compat_str) or 'limelight').lower()
if source == 'brightcove':
info = self._brightcove_result(source_id)
else:
info = self._limelight_result(source_id)
info.update({ info.update({
'title': media_data.get('title'), 'title': media_data.get('title'),
'description': try_get( 'description': try_get(