Apply fixes:

Make title field optional for ooyala extraction (the ooyala IE can get the title)
Remove duplication of get() call
Sort m3u8 formats
Made 'dvr' mandatory if not ooyalaVOD
Extract duration for akamai videos
This commit is contained in:
Michael Tilbury 2019-04-15 13:38:49 -04:00
parent 3948517e21
commit ff92503189

View File

@ -6,6 +6,7 @@ from .common import InfoExtractor
from ..utils import ( from ..utils import (
ExtractorError, ExtractorError,
url_basename, url_basename,
parse_duration,
) )
@ -33,6 +34,7 @@ class BYUtvIE(InfoExtractor):
'display_id': 'byu-soccer-w-argentina-vs-byu-4419', 'display_id': 'byu-soccer-w-argentina-vs-byu-4419',
'ext': 'mp4', 'ext': 'mp4',
'title': 'Argentina vs. BYU (4/4/19)', 'title': 'Argentina vs. BYU (4/4/19)',
'duration': 7543.0,
}, },
'params': { 'params': {
'skip_download': True 'skip_download': True
@ -60,23 +62,25 @@ class BYUtvIE(InfoExtractor):
'x-byutv-platformkey': 'xsaaw9c7y5', 'x-byutv-platformkey': 'xsaaw9c7y5',
}) })
if info.get('ooyalaVOD'): ep = info.get('ooyalaVOD')
ep = info['ooyalaVOD'] if ep:
return { return {
'_type': 'url_transparent', '_type': 'url_transparent',
'ie_key': 'Ooyala', 'ie_key': 'Ooyala',
'url': 'ooyala:%s' % ep['providerId'], 'url': 'ooyala:%s' % ep['providerId'],
'id': video_id, 'id': video_id,
'display_id': mobj.group('display_id') or video_id, 'display_id': mobj.group('display_id') or video_id,
'title': ep['title'], 'title': ep.get('title'),
'description': ep.get('description'), 'description': ep.get('description'),
'thumbnail': ep.get('imageThumbnail'), 'thumbnail': ep.get('imageThumbnail'),
} }
elif info.get('dvr'): else:
info = {}
ep = info['dvr'] ep = info['dvr']
formats = self._extract_m3u8_formats( formats = self._extract_m3u8_formats(
ep['videoUrl'], video_id, 'mp4', entry_protocol='m3u8_native' ep['videoUrl'], video_id, 'mp4', entry_protocol='m3u8_native'
) )
self._sort_formats(formats)
return { return {
'formats': formats, 'formats': formats,
'id': video_id, 'id': video_id,
@ -84,6 +88,5 @@ class BYUtvIE(InfoExtractor):
'title': ep['title'], 'title': ep['title'],
'description': ep.get('description'), 'description': ep.get('description'),
'thumbnail': ep.get('imageThumbnail'), 'thumbnail': ep.get('imageThumbnail'),
'duration': parse_duration(ep.get('length'))
} }
else:
raise ExtractorError('Unrecognized VOD type.')