[kaltura] Support iframe embeds, with test

Note that these need to back to through the Generic extractor because
the iframe URLs may be redirects that cannot be parsed by KalturaIE
without being followed, and Generic checks for such redirects and
follows them. Hence dropping the IE from url_result().
This commit is contained in:
John Hawkinson 2017-04-07 23:23:31 -04:00
parent 3461f5db06
commit ab72d14307
2 changed files with 23 additions and 1 deletions

View File

@ -1080,6 +1080,21 @@ class GenericIE(InfoExtractor):
}, },
'add_ie': ['Kaltura'], 'add_ie': ['Kaltura'],
}, },
{
# Kaltura iframe embed
'url': 'http://www.gsd.harvard.edu/event/i-m-pei-a-centennial-celebration/',
'md5': 'ae5ace8eb09dc1a35d03b579a9c2cc44',
'info_dict': {
'id': '0_f2cfbpwy',
'ext': 'mp4',
'title': 'I. M. Pei: A Centennial Celebration',
'description': 'md5:1db8f40c69edc46ca180ba30c567f37c',
'upload_date': '20170403',
'uploader_id': 'batchUser',
'timestamp': 1491232186,
},
'add_ie': ['Kaltura'],
},
# Eagle.Platform embed (generic URL) # Eagle.Platform embed (generic URL)
{ {
'url': 'http://lenta.ru/news/2015/03/06/navalny/', 'url': 'http://lenta.ru/news/2015/03/06/navalny/',
@ -2290,7 +2305,7 @@ class GenericIE(InfoExtractor):
# Look for Kaltura embeds # Look for Kaltura embeds
kaltura_url = KalturaIE._extract_url(webpage) kaltura_url = KalturaIE._extract_url(webpage)
if kaltura_url: if kaltura_url:
return self.url_result(smuggle_url(kaltura_url, {'source_url': url}), KalturaIE.ie_key()) return self.url_result(smuggle_url(kaltura_url, {'source_url': url}))
# Look for Eagle.Platform embeds # Look for Eagle.Platform embeds
eagleplatform_url = EaglePlatformIE._extract_url(webpage) eagleplatform_url = EaglePlatformIE._extract_url(webpage)

View File

@ -139,6 +139,13 @@ class KalturaIE(InfoExtractor):
url = smuggle_url(url, {'service_url': service_url.group(1)}) url = smuggle_url(url, {'service_url': service_url.group(1)})
return url return url
# Check for an iframe, which may require redirection.
mobj = re.search(
r"<iframe[^>]+src=['\"](?P<url>(https?:)?//www\.kaltura\.com/[^'\"]+)['\"]",
webpage)
if mobj:
return mobj.group('url')
def _kaltura_api_call(self, video_id, actions, service_url=None, *args, **kwargs): def _kaltura_api_call(self, video_id, actions, service_url=None, *args, **kwargs):
params = actions[0] params = actions[0]
if len(actions) > 1: if len(actions) > 1: