From 68a7b2dd03260150bffb21db0aa2a5f38484f642 Mon Sep 17 00:00:00 2001 From: doe1080 <98906116+doe1080@users.noreply.github.com> Date: Thu, 17 Jul 2025 11:44:42 +0900 Subject: [PATCH] KalturaIE --- yt_dlp/extractor/generic.py | 60 ------- yt_dlp/extractor/kaltura.py | 305 ++++++++++++++++++++---------------- 2 files changed, 172 insertions(+), 193 deletions(-) diff --git a/yt_dlp/extractor/generic.py b/yt_dlp/extractor/generic.py index 603953236..03697e1cf 100644 --- a/yt_dlp/extractor/generic.py +++ b/yt_dlp/extractor/generic.py @@ -836,66 +836,6 @@ class GenericIE(InfoExtractor): 'timestamp': 1610407738, 'upload_date': '20210111', }, - }, { - # ✅70 - # KalturaIE - 'url': 'https://www.cornell.edu/VIDEO/nima-arkani-hamed-standard-models-of-particle-physics', - 'info_dict': { - 'id': '1_sgtvehim', - 'ext': 'mp4', - 'title': 'Our "Standard Models" of particle physics and cosmology', - 'duration': 5420, - 'thumbnail': r're:https?://cdnsecakmi\.kaltura\.com/.+', - 'timestamp': 1321158993, - 'upload_date': '20111113', - 'uploader_id': 'kps1', - 'view_count': int, - }, - }, { - # ✅71 - # KalturaIE; quoted entry_id - 'url': 'https://www.oreilly.com/ideas/my-cloud-makes-pretty-pictures', - 'info_dict': { - 'id': '0_utuok90b', - 'ext': 'mp4', - 'title': '06_matthew_brender_raj_dutt', - 'duration': 331, - 'thumbnail': r're:https?://cfvod\.kaltura\.com/.+', - 'timestamp': 1466638791, - 'upload_date': '20160622', - 'uploader_id': '', - 'view_count': int, - }, - }, { - # ✅72 - # KalturaIE; quoted entry_id - 'url': 'https://fod.infobase.com/p_ViewPlaylist.aspx?AssignmentID=NUN8ZY', - 'info_dict': { - 'id': '0_izeg5utt', - 'ext': 'mp4', - 'title': '35871', - 'duration': 3403, - 'thumbnail': r're:https?://cfvod\.kaltura\.com/.+', - 'timestamp': 1355743100, - 'upload_date': '20121217', - 'uploader_id': 'cplapp@learn360.com', - 'view_count': int, - }, - }, { - # ✅73 - # KalturaIE; iframe - 'url': 'https://www.cns.nyu.edu/~eero/math-tools17/Videos/lecture-05sep2017.html', - 'info_dict': { - 'id': '1_9gzouybz', - 'ext': 'mp4', - 'title': 'lecture-05sep2017', - 'duration': 7219, - 'thumbnail': r're:https?://cfvod\.kaltura\.com/.+', - 'timestamp': 1505340777, - 'upload_date': '20170913', - 'uploader_id': 'eps2', - 'view_count': int, - }, }, { # ✅124 # YoutubeIE diff --git a/yt_dlp/extractor/kaltura.py b/yt_dlp/extractor/kaltura.py index 6d51e32f6..dc11cbf6b 100644 --- a/yt_dlp/extractor/kaltura.py +++ b/yt_dlp/extractor/kaltura.py @@ -41,149 +41,188 @@ class KalturaIE(InfoExtractor): 2: 'ttml', 3: 'vtt', } - _TESTS = [ - { - 'url': 'kaltura:269692:1_1jc2y3e4', - 'md5': '3adcbdb3dcc02d647539e53f284ba171', - 'info_dict': { - 'id': '1_1jc2y3e4', - 'ext': 'mp4', - 'title': 'Straight from the Heart', - 'upload_date': '20131219', - 'uploader_id': 'mlundberg@wolfgangsvault.com', - 'description': 'The Allman Brothers Band, 12/16/1981', - 'thumbnail': 're:^https?://.*/thumbnail/.*', - 'timestamp': int, + _TESTS = [{ + 'url': 'kaltura:269692:1_1jc2y3e4', + 'md5': '3adcbdb3dcc02d647539e53f284ba171', + 'info_dict': { + 'id': '1_1jc2y3e4', + 'ext': 'mp4', + 'title': 'Straight from the Heart', + 'upload_date': '20131219', + 'uploader_id': 'mlundberg@wolfgangsvault.com', + 'description': 'The Allman Brothers Band, 12/16/1981', + 'thumbnail': r're:https?://.+/thumbnail/.+', + 'timestamp': int, + }, + 'skip': 'The access to this service is forbidden since the specified partner is blocked', + }, { + 'url': 'http://www.kaltura.com/index.php/kwidget/cache_st/1300318621/wid/_269692/uiconf_id/3873291/entry_id/1_1jc2y3e4', + 'only_matching': True, + }, { + 'url': 'https://cdnapisec.kaltura.com/index.php/kwidget/wid/_557781/uiconf_id/22845202/entry_id/1_plr1syf3', + 'only_matching': True, + }, { + 'url': 'https://cdnapisec.kaltura.com/html5/html5lib/v2.30.2/mwEmbedFrame.php/p/1337/uiconf_id/20540612/entry_id/1_sf5ovm7u?wid=_243342', + 'only_matching': True, + }, { + # video with subtitles + 'url': 'kaltura:111032:1_cw786r8q', + 'only_matching': True, + }, { + # video with ttml subtitles (no fileExt) + 'url': 'kaltura:1926081:0_l5ye1133', + 'info_dict': { + 'id': '0_l5ye1133', + 'ext': 'mp4', + 'title': 'What Can You Do With Python?', + 'upload_date': '20160221', + 'uploader_id': 'stork', + 'thumbnail': r're:https?://.+/thumbnail/.+', + 'timestamp': int, + 'subtitles': { + 'en': [{ + 'ext': 'ttml', + }], }, - 'skip': 'The access to this service is forbidden since the specified partner is blocked', }, - { - 'url': 'http://www.kaltura.com/index.php/kwidget/cache_st/1300318621/wid/_269692/uiconf_id/3873291/entry_id/1_1jc2y3e4', - 'only_matching': True, + 'skip': 'Gone. Maybe https://www.safaribooksonline.com/library/tutorials/introduction-to-python-anon/3469/', + 'params': {'skip_download': True}, + }, { + 'url': 'https://www.kaltura.com/index.php/extwidget/preview/partner_id/1770401/uiconf_id/37307382/entry_id/0_58u8kme7/embed/iframe?&flashvars[streamerType]=auto', + 'only_matching': True, + }, { + 'url': 'https://www.kaltura.com:443/index.php/extwidget/preview/partner_id/1770401/uiconf_id/37307382/entry_id/0_58u8kme7/embed/iframe?&flashvars[streamerType]=auto', + 'only_matching': True, + }, { + # unavailable source format + 'url': 'kaltura:513551:1_66x4rg7o', + 'only_matching': True, + }, { + # html5lib URL using kwidget player + 'url': 'https://cdnapisec.kaltura.com/html5/html5lib/v2.46/mwEmbedFrame.php/p/691292/uiconf_id/20499062/entry_id/0_c076mna6?wid=_691292&iframeembed=true&playerId=kaltura_player_1420508608&entry_id=0_c076mna6&flashvars%5BakamaiHD.loadingPolicy%5D=preInitialize&flashvars%5BakamaiHD.asyncInit%5D=true&flashvars%5BstreamerType%5D=hdnetwork', + 'info_dict': { + 'id': '0_c076mna6', + 'ext': 'mp4', + 'title': 'md5:4883e7acbcbf42583a2dddc97dee4855', + 'duration': 3608, + 'uploader_id': 'commons@swinburne.edu.au', + 'timestamp': 1408086874, + 'view_count': int, + 'upload_date': '20140815', + 'thumbnail': r're:https?://cfvod\.kaltura\.com/.+', }, - { - 'url': 'https://cdnapisec.kaltura.com/index.php/kwidget/wid/_557781/uiconf_id/22845202/entry_id/1_plr1syf3', - 'only_matching': True, + }, { + # html5lib playlist URL using kwidget player + 'url': 'https://cdnapisec.kaltura.com/html5/html5lib/v2.89/mwEmbedFrame.php/p/2019031/uiconf_id/40436601?wid=1_4j3m32cv&iframeembed=true&playerId=kaltura_player_&flashvars[playlistAPI.kpl0Id]=1_jovey5nu&flashvars[ks]=&&flashvars[imageDefaultDuration]=30&flashvars[localizationCode]=en&flashvars[leadWithHTML5]=true&flashvars[forceMobileHTML5]=true&flashvars[nextPrevBtn.plugin]=true&flashvars[hotspots.plugin]=true&flashvars[sideBarContainer.plugin]=true&flashvars[sideBarContainer.position]=left&flashvars[sideBarContainer.clickToClose]=true&flashvars[chapters.plugin]=true&flashvars[chapters.layout]=vertical&flashvars[chapters.thumbnailRotator]=false&flashvars[streamSelector.plugin]=true&flashvars[EmbedPlayer.SpinnerTarget]=videoHolder&flashvars[dualScreen.plugin]=true&flashvars[playlistAPI.playlistUrl]=https://canvasgatechtest.kaf.kaltura.com/playlist/details/{playlistAPI.kpl0Id}/categoryid/126428551', + 'info_dict': { + 'id': '1_jovey5nu', + 'title': '00-00 Introduction', }, - { - 'url': 'https://cdnapisec.kaltura.com/html5/html5lib/v2.30.2/mwEmbedFrame.php/p/1337/uiconf_id/20540612/entry_id/1_sf5ovm7u?wid=_243342', - 'only_matching': True, - }, - { - # video with subtitles - 'url': 'kaltura:111032:1_cw786r8q', - 'only_matching': True, - }, - { - # video with ttml subtitles (no fileExt) - 'url': 'kaltura:1926081:0_l5ye1133', - 'info_dict': { - 'id': '0_l5ye1133', - 'ext': 'mp4', - 'title': 'What Can You Do With Python?', - 'upload_date': '20160221', - 'uploader_id': 'stork', - 'thumbnail': 're:^https?://.*/thumbnail/.*', - 'timestamp': int, - 'subtitles': { - 'en': [{ - 'ext': 'ttml', - }], + 'playlist': [ + { + 'info_dict': { + 'id': '1_b1y5hlvx', + 'ext': 'mp4', + 'title': 'CS7646_00-00 Introductio_Introduction', + 'duration': 91, + 'thumbnail': r're:https?://cfvod\.kaltura\.com/.+', + 'view_count': int, + 'timestamp': 1533154447, + 'upload_date': '20180801', + 'uploader_id': 'djoyner3', + }, + }, { + 'info_dict': { + 'id': '1_jfb7mdpn', + 'ext': 'mp4', + 'title': 'CS7646_00-00 Introductio_Three parts to the course', + 'duration': 63, + 'thumbnail': r're:https?://cfvod\.kaltura\.com/.+', + 'view_count': int, + 'timestamp': 1533154489, + 'upload_date': '20180801', + 'uploader_id': 'djoyner3', + }, + }, { + 'info_dict': { + 'id': '1_8xflxdp7', + 'ext': 'mp4', + 'title': 'CS7646_00-00 Introductio_Textbooks', + 'duration': 37, + 'thumbnail': r're:https?://cfvod\.kaltura\.com/.+', + 'view_count': int, + 'timestamp': 1533154512, + 'upload_date': '20180801', + 'uploader_id': 'djoyner3', + }, + }, { + 'info_dict': { + 'id': '1_3hqew8kn', + 'ext': 'mp4', + 'title': 'CS7646_00-00 Introductio_Prerequisites', + 'duration': 49, + 'thumbnail': r're:https?://cfvod\.kaltura\.com/.+', + 'view_count': int, + 'timestamp': 1533154536, + 'upload_date': '20180801', + 'uploader_id': 'djoyner3', }, }, - 'skip': 'Gone. Maybe https://www.safaribooksonline.com/library/tutorials/introduction-to-python-anon/3469/', - 'params': { - 'skip_download': True, - }, + ], + }] + _WEBPAGE_TESTS = [{ + 'url': 'https://www.cornell.edu/VIDEO/nima-arkani-hamed-standard-models-of-particle-physics', + 'info_dict': { + 'id': '1_sgtvehim', + 'ext': 'mp4', + 'title': 'Our "Standard Models" of particle physics and cosmology', + 'duration': 5420, + 'thumbnail': r're:https?://cdnsecakmi\.kaltura\.com/.+', + 'timestamp': 1321158993, + 'upload_date': '20111113', + 'uploader_id': 'kps1', + 'view_count': int, }, - { - 'url': 'https://www.kaltura.com/index.php/extwidget/preview/partner_id/1770401/uiconf_id/37307382/entry_id/0_58u8kme7/embed/iframe?&flashvars[streamerType]=auto', - 'only_matching': True, + }, { + 'url': 'https://www.oreilly.com/ideas/my-cloud-makes-pretty-pictures', + 'info_dict': { + 'id': '0_utuok90b', + 'ext': 'mp4', + 'title': '06_matthew_brender_raj_dutt', + 'duration': 331, + 'thumbnail': r're:https?://cfvod\.kaltura\.com/.+', + 'timestamp': 1466638791, + 'upload_date': '20160622', + 'uploader_id': '', + 'view_count': int, }, - { - 'url': 'https://www.kaltura.com:443/index.php/extwidget/preview/partner_id/1770401/uiconf_id/37307382/entry_id/0_58u8kme7/embed/iframe?&flashvars[streamerType]=auto', - 'only_matching': True, + }, { + 'url': 'https://fod.infobase.com/p_ViewPlaylist.aspx?AssignmentID=NUN8ZY', + 'info_dict': { + 'id': '0_izeg5utt', + 'ext': 'mp4', + 'title': '35871', + 'duration': 3403, + 'thumbnail': r're:https?://cfvod\.kaltura\.com/.+', + 'timestamp': 1355743100, + 'upload_date': '20121217', + 'uploader_id': 'cplapp@learn360.com', + 'view_count': int, }, - { - # unavailable source format - 'url': 'kaltura:513551:1_66x4rg7o', - 'only_matching': True, + }, { + 'url': 'https://www.cns.nyu.edu/~eero/math-tools17/Videos/lecture-05sep2017.html', + 'info_dict': { + 'id': '1_9gzouybz', + 'ext': 'mp4', + 'title': 'lecture-05sep2017', + 'duration': 7219, + 'thumbnail': r're:https?://cfvod\.kaltura\.com/.+', + 'timestamp': 1505340777, + 'upload_date': '20170913', + 'uploader_id': 'eps2', + 'view_count': int, }, - { - # html5lib URL using kwidget player - 'url': 'https://cdnapisec.kaltura.com/html5/html5lib/v2.46/mwEmbedFrame.php/p/691292/uiconf_id/20499062/entry_id/0_c076mna6?wid=_691292&iframeembed=true&playerId=kaltura_player_1420508608&entry_id=0_c076mna6&flashvars%5BakamaiHD.loadingPolicy%5D=preInitialize&flashvars%5BakamaiHD.asyncInit%5D=true&flashvars%5BstreamerType%5D=hdnetwork', - 'info_dict': { - 'id': '0_c076mna6', - 'ext': 'mp4', - 'title': 'md5:4883e7acbcbf42583a2dddc97dee4855', - 'duration': 3608, - 'uploader_id': 'commons@swinburne.edu.au', - 'timestamp': 1408086874, - 'view_count': int, - 'upload_date': '20140815', - 'thumbnail': 'http://cfvod.kaltura.com/p/691292/sp/69129200/thumbnail/entry_id/0_c076mna6/version/100022', - }, - }, - { - # html5lib playlist URL using kwidget player - 'url': 'https://cdnapisec.kaltura.com/html5/html5lib/v2.89/mwEmbedFrame.php/p/2019031/uiconf_id/40436601?wid=1_4j3m32cv&iframeembed=true&playerId=kaltura_player_&flashvars[playlistAPI.kpl0Id]=1_jovey5nu&flashvars[ks]=&&flashvars[imageDefaultDuration]=30&flashvars[localizationCode]=en&flashvars[leadWithHTML5]=true&flashvars[forceMobileHTML5]=true&flashvars[nextPrevBtn.plugin]=true&flashvars[hotspots.plugin]=true&flashvars[sideBarContainer.plugin]=true&flashvars[sideBarContainer.position]=left&flashvars[sideBarContainer.clickToClose]=true&flashvars[chapters.plugin]=true&flashvars[chapters.layout]=vertical&flashvars[chapters.thumbnailRotator]=false&flashvars[streamSelector.plugin]=true&flashvars[EmbedPlayer.SpinnerTarget]=videoHolder&flashvars[dualScreen.plugin]=true&flashvars[playlistAPI.playlistUrl]=https://canvasgatechtest.kaf.kaltura.com/playlist/details/{playlistAPI.kpl0Id}/categoryid/126428551', - 'info_dict': { - 'id': '1_jovey5nu', - 'title': '00-00 Introduction', - }, - 'playlist': [ - { - 'info_dict': { - 'id': '1_b1y5hlvx', - 'ext': 'mp4', - 'title': 'CS7646_00-00 Introductio_Introduction', - 'duration': 91, - 'thumbnail': 'http://cfvod.kaltura.com/p/2019031/sp/201903100/thumbnail/entry_id/1_b1y5hlvx/version/100001', - 'view_count': int, - 'timestamp': 1533154447, - 'upload_date': '20180801', - 'uploader_id': 'djoyner3', - }, - }, { - 'info_dict': { - 'id': '1_jfb7mdpn', - 'ext': 'mp4', - 'title': 'CS7646_00-00 Introductio_Three parts to the course', - 'duration': 63, - 'thumbnail': 'http://cfvod.kaltura.com/p/2019031/sp/201903100/thumbnail/entry_id/1_jfb7mdpn/version/100001', - 'view_count': int, - 'timestamp': 1533154489, - 'upload_date': '20180801', - 'uploader_id': 'djoyner3', - }, - }, { - 'info_dict': { - 'id': '1_8xflxdp7', - 'ext': 'mp4', - 'title': 'CS7646_00-00 Introductio_Textbooks', - 'duration': 37, - 'thumbnail': 'http://cfvod.kaltura.com/p/2019031/sp/201903100/thumbnail/entry_id/1_8xflxdp7/version/100001', - 'view_count': int, - 'timestamp': 1533154512, - 'upload_date': '20180801', - 'uploader_id': 'djoyner3', - }, - }, { - 'info_dict': { - 'id': '1_3hqew8kn', - 'ext': 'mp4', - 'title': 'CS7646_00-00 Introductio_Prerequisites', - 'duration': 49, - 'thumbnail': 'http://cfvod.kaltura.com/p/2019031/sp/201903100/thumbnail/entry_id/1_3hqew8kn/version/100001', - 'view_count': int, - 'timestamp': 1533154536, - 'upload_date': '20180801', - 'uploader_id': 'djoyner3', - }, - }, - ], - }, - ] + }] @classmethod def _extract_embed_urls(cls, url, webpage):