1
0
mirror of https://github.com/l1ving/youtube-dl synced 2025-02-03 14:22:56 +08:00

[kaltura] Be rigorous on iframe

Per @dstftw, don't pull out just any kaltura.com iframes, make sure they
have /p/{PARTNER_ID} and &entry_id={ENTRY_ID} and return a kaltura: URL.

Go back to specifying the IE is Kaltura in url_result().
This commit is contained in:
John Hawkinson 2017-04-08 04:21:52 -04:00
parent 07970f3ae2
commit 4905e589d7
2 changed files with 12 additions and 9 deletions

View File

@ -2305,7 +2305,7 @@ class GenericIE(InfoExtractor):
# Look for Kaltura embeds
kaltura_url = KalturaIE._extract_url(webpage)
if kaltura_url:
return self.url_result(smuggle_url(kaltura_url, {'source_url': url}))
return self.url_result(smuggle_url(kaltura_url, {'source_url': url}), KalturaIE.ie_key())
# Look for Eagle.Platform embeds
eagleplatform_url = EaglePlatformIE._extract_url(webpage)

View File

@ -128,7 +128,17 @@ class KalturaIE(InfoExtractor):
(?P<q2>["\'])entry_?[Ii]d(?P=q2)
)\s*:\s*
(?P<q3>["\'])(?P<id>(?:(?!(?P=q3)).)+)(?P=q3)
''', webpage))
''', webpage) or
re.search(
# <iframe src="http://www.kaltura.com/p/{PARTNER_ID}/sp/{PARTNER_ID}00/embedIframeJs/uiconf_id/{UICONF_ID}/partner_id/{PARTNER_ID}?iframeembed=true&playerId={UNIQUE_OBJ_ID}&entry_id={ENTRY_ID}" width="400" height="330" allowfullscreen webkitallowfullscreen mozAllowFullScreen frameborder="0"></iframe>
r'''(?xs)
(?P<q1>["\'])
(?:https?:)?//(?:www\.)?kaltura\.com/p/(?P<partner_id>\d+)/
(?:(?!(?P=q1)).)*
[\?&]entry_id=(?P<id>(?:(?!(?P=q1))[^&])+)
(?P=q1)
''', webpage)
)
if mobj:
embed_info = mobj.groupdict()
url = 'kaltura:%(partner_id)s:%(id)s' % embed_info
@ -140,13 +150,6 @@ class KalturaIE(InfoExtractor):
url = smuggle_url(url, {'service_url': service_url.group(1)})
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):
params = actions[0]
if len(actions) > 1: