From ff92503189c00262f9ca737194208cf7dcd5c2d9 Mon Sep 17 00:00:00 2001 From: Michael Tilbury Date: Mon, 15 Apr 2019 13:38:49 -0400 Subject: [PATCH] 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 --- youtube_dl/extractor/byutv.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/youtube_dl/extractor/byutv.py b/youtube_dl/extractor/byutv.py index b69b9eec4..4ce2eb91f 100644 --- a/youtube_dl/extractor/byutv.py +++ b/youtube_dl/extractor/byutv.py @@ -6,6 +6,7 @@ from .common import InfoExtractor from ..utils import ( ExtractorError, url_basename, + parse_duration, ) @@ -33,6 +34,7 @@ class BYUtvIE(InfoExtractor): 'display_id': 'byu-soccer-w-argentina-vs-byu-4419', 'ext': 'mp4', 'title': 'Argentina vs. BYU (4/4/19)', + 'duration': 7543.0, }, 'params': { 'skip_download': True @@ -60,23 +62,25 @@ class BYUtvIE(InfoExtractor): 'x-byutv-platformkey': 'xsaaw9c7y5', }) - if info.get('ooyalaVOD'): - ep = info['ooyalaVOD'] + ep = info.get('ooyalaVOD') + if ep: return { '_type': 'url_transparent', 'ie_key': 'Ooyala', 'url': 'ooyala:%s' % ep['providerId'], 'id': video_id, 'display_id': mobj.group('display_id') or video_id, - 'title': ep['title'], + 'title': ep.get('title'), 'description': ep.get('description'), 'thumbnail': ep.get('imageThumbnail'), } - elif info.get('dvr'): + else: + info = {} ep = info['dvr'] formats = self._extract_m3u8_formats( ep['videoUrl'], video_id, 'mp4', entry_protocol='m3u8_native' ) + self._sort_formats(formats) return { 'formats': formats, 'id': video_id, @@ -84,6 +88,5 @@ class BYUtvIE(InfoExtractor): 'title': ep['title'], 'description': ep.get('description'), 'thumbnail': ep.get('imageThumbnail'), + 'duration': parse_duration(ep.get('length')) } - else: - raise ExtractorError('Unrecognized VOD type.')