-# coding: utf-8
-from __future__ import unicode_literals
-
from .common import InfoExtractor
-from ..compat import compat_str
from ..utils import (
ExtractorError,
- int_or_none,
float_or_none,
+ int_or_none,
smuggle_url,
str_or_none,
try_get,
'upload_date': '20210421',
},
'expected_warnings': ['Ignoring subtitle tracks'],
- 'params':{
+ 'params': {
'skip_download': True,
- }
+ },
}]
BRIGHTCOVE_URL_TEMPLATE = 'http://players.brightcove.net/4460760524001/default_default/index.html?videoId=%s'
for kind in ('episode', 'clip'):
current_key = page_data.get(kind, {}).get(
- 'current%sKey' % kind.capitalize())
+ f'current{kind.capitalize()}Key')
if not current_key:
continue
- cache = page_data.get(kind, {}).get('%sCache' % kind, {})
+ cache = page_data.get(kind, {}).get(f'{kind}Cache', {})
if not cache:
continue
common_data = {
- 'episode': (cache.get(current_key) or list(cache.values())[0])[kind],
- 'season': (cache.get(current_key) or list(cache.values())[0]).get('season', None)
+ 'episode': (cache.get(current_key) or next(iter(cache.values())))[kind],
+ 'season': (cache.get(current_key) or next(iter(cache.values()))).get('season', None),
}
break
else:
if not self.get_param('allow_unplayable_formats') and try_get(common_data, lambda x: x['episode']['video']['drm'], bool):
self.report_drm(display_id)
brightcove_id = try_get(
- common_data, lambda x: x['episode']['video']['brightcoveId'], compat_str) or 'ref:%s' % common_data['episode']['video']['referenceId']
+ common_data, lambda x: x['episode']['video']['brightcoveId'], str) or 'ref:{}'.format(common_data['episode']['video']['referenceId'])
video_id = str_or_none(try_get(common_data, lambda x: x['episode']['video']['id'])) or brightcove_id
- title = try_get(common_data, lambda x: x['episode']['name'], compat_str)
+ title = try_get(common_data, lambda x: x['episode']['name'], str)
season_number = try_get(common_data, lambda x: x['season']['seasonNumber'], int)
episode_number = try_get(common_data, lambda x: x['episode']['episodeNumber'], int)
- timestamp = unified_timestamp(try_get(common_data, lambda x: x['episode']['airDate'], compat_str))
- release_date = unified_strdate(try_get(common_data, lambda x: x['episode']['availability'], compat_str))
+ timestamp = unified_timestamp(try_get(common_data, lambda x: x['episode']['airDate'], str))
+ release_date = unified_strdate(try_get(common_data, lambda x: x['episode']['availability'], str))
thumbnails_data = try_get(common_data, lambda x: x['episode']['image']['sizes'], dict) or {}
thumbnails = [{
'id': thumbnail_id,
{'geo_countries': self._GEO_COUNTRIES}),
'id': video_id,
'title': title,
- 'description': try_get(common_data, lambda x: x['episode']['description'], compat_str),
+ 'description': try_get(common_data, lambda x: x['episode']['description'], str),
'duration': float_or_none(try_get(common_data, lambda x: x['episode']['video']['duration'], float), 1000),
'thumbnails': thumbnails,
'ie_key': 'BrightcoveNew',