]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/opencast.py
[ie/mlbtv] Fix extraction (#10296)
[yt-dlp.git] / yt_dlp / extractor / opencast.py
index c640224dd6d889a07fcf860ce2170243655c9e97..a4b0a1989d3b33a6a3bb7f49c019943abb6c8253 100644 (file)
@@ -2,8 +2,8 @@
 
 from .common import InfoExtractor
 from ..utils import (
-    determine_ext,
     ExtractorError,
+    determine_ext,
     int_or_none,
     parse_iso8601,
     traverse_obj,
@@ -55,9 +55,9 @@ def _parse_mediapackage(self, video):
             transport = track.get('transport')
 
             if transport == 'DASH' or ext == 'mpd':
-                formats.extend(self._extract_mpd_formats_and_subtitles(href, video_id, mpd_id='dash', fatal=False))
+                formats.extend(self._extract_mpd_formats(href, video_id, mpd_id='dash', fatal=False))
             elif transport == 'HLS' or ext == 'm3u8':
-                formats.extend(self._extract_m3u8_formats_and_subtitles(
+                formats.extend(self._extract_m3u8_formats(
                     href, video_id, m3u8_id='hls', entry_protocol='m3u8_native', fatal=False))
             elif transport == 'HDS' or ext == 'f4m':
                 formats.extend(self._extract_f4m_formats(href, video_id, f4m_id='hds', fatal=False))
@@ -92,8 +92,6 @@ def _parse_mediapackage(self, video):
                     })
                 formats.append(track_obj)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
             'formats': formats,
@@ -107,10 +105,9 @@ def _parse_mediapackage(self, video):
 
 
 class OpencastIE(OpencastBaseIE):
-    _VALID_URL = r'''(?x)
-                    https?://(?P<host>%s)/paella/ui/watch.html\?.*?
-                    id=(?P<id>%s)
-                    ''' % (OpencastBaseIE._INSTANCES_RE, OpencastBaseIE._UUID_RE)
+    _VALID_URL = rf'''(?x)
+        https?://(?P<host>{OpencastBaseIE._INSTANCES_RE})/paella/ui/watch\.html\?
+        (?:[^#]+&)?id=(?P<id>{OpencastBaseIE._UUID_RE})'''
 
     _API_BASE = 'https://%s/search/episode.json?id=%s'
 
@@ -125,8 +122,11 @@ class OpencastIE(OpencastBaseIE):
                 'thumbnail': r're:^https?://.*\.jpg$',
                 'timestamp': 1606208400,
                 'upload_date': '20201124',
+                'season_id': 'cf68a4a1-36b1-4a53-a6ba-61af5705a0d0',
+                'series': 'Kryptographie - WiSe 15/16',
+                'creator': 'Alexander May',
             },
-        }
+        },
     ]
 
     def _real_extract(self, url):
@@ -136,10 +136,11 @@ def _real_extract(self, url):
 
 
 class OpencastPlaylistIE(OpencastBaseIE):
-    _VALID_URL = r'''(?x)
-                            https?://(?P<host>%s)/engage/ui/index.html\?.*?
-                            epFrom=(?P<id>%s)
-                    ''' % (OpencastBaseIE._INSTANCES_RE, OpencastBaseIE._UUID_RE)
+    _VALID_URL = rf'''(?x)
+        https?://(?P<host>{OpencastBaseIE._INSTANCES_RE})(?:
+            /engage/ui/index\.html\?(?:[^#]+&)?epFrom=|
+            /ltitools/index\.html\?(?:[^#]+&)?series=
+        )(?P<id>{OpencastBaseIE._UUID_RE})'''
 
     _API_BASE = 'https://%s/search/episode.json?sid=%s'
 
@@ -150,15 +151,23 @@ class OpencastPlaylistIE(OpencastBaseIE):
                 'id': 'cf68a4a1-36b1-4a53-a6ba-61af5705a0d0',
                 'title': 'Kryptographie - WiSe 15/16',
             },
-            'playlist_mincount': 28,
+            'playlist_mincount': 29,
+        },
+        {
+            'url': 'https://oc-video1.ruhr-uni-bochum.de/ltitools/index.html?subtool=series&series=cf68a4a1-36b1-4a53-a6ba-61af5705a0d0&lng=de',
+            'info_dict': {
+                'id': 'cf68a4a1-36b1-4a53-a6ba-61af5705a0d0',
+                'title': 'Kryptographie - WiSe 15/16',
+            },
+            'playlist_mincount': 29,
         },
         {
-            'url': 'https://oc-video.ruhr-uni-bochum.de/engage/ui/index.html?e=1&p=1&epFrom=b1a54262-3684-403f-9731-8e77c3766f9a',
+            'url': 'https://electures.uni-muenster.de/engage/ui/index.html?e=1&p=1&epFrom=39391d10-a711-4d23-b21d-afd2ed7d758c',
             'info_dict': {
-                'id': 'b1a54262-3684-403f-9731-8e77c3766f9a',
-                'title': 'inSTUDIES-Social movements and prefigurative politics in a global perspective',
+                'id': '39391d10-a711-4d23-b21d-afd2ed7d758c',
+                'title': '021670 Theologische Themen bei Hans Blumenberg WiSe 2017/18',
             },
-            'playlist_mincount': 6,
+            'playlist_mincount': 13,
         },
     ]