From d68afc5bc9f0d6cbf49751f95db6f1b8e7c1403e Mon Sep 17 00:00:00 2001 From: Tithen-Firion Date: Thu, 27 Apr 2017 15:27:01 +0200 Subject: [PATCH] [cbsinteractive] fix extractor --- youtube_dl/extractor/cbsinteractive.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/cbsinteractive.py b/youtube_dl/extractor/cbsinteractive.py index 57b18e81d..3d48a7cb1 100644 --- a/youtube_dl/extractor/cbsinteractive.py +++ b/youtube_dl/extractor/cbsinteractive.py @@ -4,6 +4,7 @@ import re from .theplatform import ThePlatformIE +from ..compat import compat_urllib_parse from ..utils import int_or_none @@ -80,7 +81,7 @@ def _real_extract(self, url): media_guid_path = 'media/guid/%d/%s' % (self.MPX_ACCOUNTS[site], vdata['mpxRefId']) formats, subtitles = [], {} - for (fkey, vid) in vdata['files'].items(): + for (fkey, vid) in vdata.get('files', {}).items(): if fkey == 'hls_phone' and 'hls_tablet' in vdata['files']: continue release_url = self.TP_RELEASE_URL_TEMPLATE % vid @@ -89,6 +90,23 @@ def _real_extract(self, url): tp_formats, tp_subtitles = self._extract_theplatform_smil(release_url, video_id, 'Downloading %s SMIL data' % fkey) formats.extend(tp_formats) subtitles = self._merge_subtitles(subtitles, tp_subtitles) + + if 'm3u8' in vdata: + parsed_url = compat_urllib_parse.urlparse(url) + m3u8_url = ('%s://%s%s' + % (parsed_url.scheme, parsed_url.netloc, vdata['m3u8'])) + m3u8_formats = self._extract_m3u8_formats(m3u8_url, video_id) + for format in m3u8_formats: + format['url'] = format['url'].replace('https://', 'http://') + formats.extend(m3u8_formats) + + if 'mp4' in vdata: + formats.append({ + 'url': vdata['mp4'], + 'format_id': 'mp4', + 'ext': 'mp4', + }) + self._sort_formats(formats) info = self._extract_theplatform_metadata('kYEXFC/%s' % media_guid_path, video_id)