]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/yle_areena.py
[ie/generic] Add `key_query` extractor-arg
[yt-dlp.git] / yt_dlp / extractor / yle_areena.py
index 98d3b1949a4228bcfc69a84bd379e10b741ecbe4..796f7f3167511b5e783a5acb1d89395313d57d10 100644 (file)
@@ -34,8 +34,8 @@ class YleAreenaIE(InfoExtractor):
                 'timestamp': 1543916210,
                 'subtitles': {'fin': [{'url': r're:^https?://', 'ext': 'srt'}]},
                 'age_limit': 7,
-                'webpage_url': 'https://areena.yle.fi/1-4371942'
-            }
+                'webpage_url': 'https://areena.yle.fi/1-4371942',
+            },
         },
         {
             'url': 'https://areena.yle.fi/1-2158940',
@@ -46,10 +46,6 @@ class YleAreenaIE(InfoExtractor):
                 'title': 'Albi haluaa vessan',
                 'description': 'md5:15236d810c837bed861fae0e88663c33',
                 'series': 'Albi Lumiukko',
-                'season': None,
-                'season_number': None,
-                'episode': None,
-                'episode_number': None,
                 'thumbnail': 'http://cfvod.kaltura.com/p/1955031/sp/195503100/thumbnail/entry_id/1_l38iz9ur/version/100021',
                 'uploader_id': 'ovp@yle.fi',
                 'duration': 319,
@@ -59,9 +55,24 @@ class YleAreenaIE(InfoExtractor):
                 'timestamp': 1638448202,
                 'subtitles': {},
                 'age_limit': 0,
-                'webpage_url': 'https://areena.yle.fi/1-2158940'
-            }
-        }
+                'webpage_url': 'https://areena.yle.fi/1-2158940',
+            },
+        },
+        {
+            'url': 'https://areena.yle.fi/1-64829589',
+            'info_dict': {
+                'id': '1-64829589',
+                'ext': 'mp4',
+                'title': 'HKO & Mälkki & Tanner',
+                'description': 'md5:b4f1b1af2c6569b33f75179a86eea156',
+                'series': 'Helsingin kaupunginorkesterin konsertteja',
+                'thumbnail': r're:^https?://.+\.jpg$',
+                'release_date': '20230120',
+            },
+            'params': {
+                'skip_download': 'm3u8',
+            },
+        },
     ]
 
     def _real_extract(self, url):
@@ -72,7 +83,7 @@ def _real_extract(self, url):
             video_id, headers={
                 'origin': 'https://areena.yle.fi',
                 'referer': 'https://areena.yle.fi/',
-                'content-type': 'application/json'
+                'content-type': 'application/json',
             })
 
         # Example title: 'K1, J2: Pouchit | Modernit miehet'
@@ -91,12 +102,22 @@ def _real_extract(self, url):
                     'name': sub.get('kind'),
                 })
 
+        kaltura_id = traverse_obj(video_data, ('data', 'ongoing_ondemand', 'kaltura', 'id'), expected_type=str)
+        if kaltura_id:
+            info_dict = {
+                '_type': 'url_transparent',
+                'url': smuggle_url(f'kaltura:1955031:{kaltura_id}', {'source_url': url}),
+                'ie_key': KalturaIE.ie_key(),
+            }
+        else:
+            info_dict = {
+                'id': video_id,
+                'formats': self._extract_m3u8_formats(
+                    video_data['data']['ongoing_ondemand']['manifest_url'], video_id, 'mp4', m3u8_id='hls'),
+            }
+
         return {
-            '_type': 'url_transparent',
-            'url': smuggle_url(
-                f'kaltura:1955031:{video_data["data"]["ongoing_ondemand"]["kaltura"]["id"]}',
-                {'source_url': url}),
-            'ie_key': KalturaIE.ie_key(),
+            **info_dict,
             'title': (traverse_obj(video_data, ('data', 'ongoing_ondemand', 'title', 'fin'), expected_type=str)
                       or episode or info.get('title')),
             'description': description,