From 6d17aa096fedc0a9df46ea67847d035caf13e333 Mon Sep 17 00:00:00 2001 From: Mike Ruprecht Date: Wed, 4 May 2016 01:07:08 -0500 Subject: [PATCH 1/2] [kaltura] Support 'applehttp' containerFormat This patch adds support for Kaltura video flavors with the containerFormat 'applehttp'. In this case, the data returned from the url is an m3u8 file which can subsequently be downloaded normally. This is what AbcGo uses for its content. --- youtube_dl/extractor/kaltura.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/kaltura.py b/youtube_dl/extractor/kaltura.py index a65697ff5..d6c85a14b 100644 --- a/youtube_dl/extractor/kaltura.py +++ b/youtube_dl/extractor/kaltura.py @@ -175,11 +175,18 @@ class KalturaIE(InfoExtractor): unsigned_url += '?referrer=%s' % referrer return unsigned_url + has_native_formats = False formats = [] for f in flavor_assets: # Continue if asset is not ready if f['status'] != 2: continue + if f['containerFormat'] == 'applehttp': + m3u8_url = sign_url(info['dataUrl']) + formats.extend(self._extract_m3u8_formats( + m3u8_url, entry_id, 'mp4', m3u8_id='hls', fatal=False)) + continue + has_native_formats=True video_url = sign_url('%s/flavorId/%s' % (info['dataUrl'], f['id'])) formats.append({ 'format_id': '%(fileExt)s-%(bitrate)s' % f, @@ -193,9 +200,13 @@ class KalturaIE(InfoExtractor): 'width': int_or_none(f.get('width')), 'url': video_url, }) - m3u8_url = sign_url(info['dataUrl'].replace('format/url', 'format/applehttp')) - formats.extend(self._extract_m3u8_formats( - m3u8_url, entry_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)) + + if has_native_formats: + m3u8_url = sign_url(info['dataUrl'].replace( + 'format/url', 'format/applehttp')) + formats.extend(self._extract_m3u8_formats( + m3u8_url, entry_id, 'mp4', 'm3u8_native', m3u8_id='hls', + fatal=False)) self._check_formats(formats, entry_id) self._sort_formats(formats) From a78c1de752dbdd547dceea8721bee734c1409316 Mon Sep 17 00:00:00 2001 From: Mike Ruprecht Date: Wed, 4 May 2016 01:13:45 -0500 Subject: [PATCH 2/2] [abcgo] Add new extractor This patch adds an extractor for abc.go.com. The test case url is unfortunately only available for a few weeks before it expires. --- youtube_dl/extractor/abcgo.py | 37 ++++++++++++++++++++++++++++++ youtube_dl/extractor/extractors.py | 1 + 2 files changed, 38 insertions(+) create mode 100644 youtube_dl/extractor/abcgo.py diff --git a/youtube_dl/extractor/abcgo.py b/youtube_dl/extractor/abcgo.py new file mode 100644 index 000000000..c4b3edbb8 --- /dev/null +++ b/youtube_dl/extractor/abcgo.py @@ -0,0 +1,37 @@ +from __future__ import unicode_literals + +from .common import InfoExtractor + +class AbcGoIE(InfoExtractor): + IE_NAME = 'abc.go.com' + _VALID_URL = r'http://abc.go.com/shows/(?P.*)' + _TEST = { + 'url': 'http://abc.go.com/shows/marvels-agents-of-shield/episode-guide/season-03/17-the-team', + 'info_dict': { + 'id': '0_ebiua3ib', + 'ext': 'mp4', + 'title': 'The Team', + 'description': 'S.H.I.E.L.D. learns more about Hive\'s powers.', + 'uploader_id': 'KMCMigrator', + 'timestamp': 1461160081, + 'upload_date': '20160420', + }, + 'params': { + 'skip_download': True + } + } + + PARTNER_ID='585231' + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + + video_id = self._html_search_regex(r'vp:video="VDKA(.*?)"', webpage, + 'id') + + return { + '_type': 'url', + 'url': 'kaltura:%s:%s' % (self.PARTNER_ID, video_id), + 'ie_key': 'Kaltura', + } diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index ef4431364..8a8fa7546 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from .abc import ABCIE from .abc7news import Abc7NewsIE +from .abcgo import AbcGoIE from .academicearth import AcademicEarthCourseIE from .acast import ( ACastIE,