]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/olympics.py
[ie/mlbtv] Fix extraction (#10296)
[yt-dlp.git] / yt_dlp / extractor / olympics.py
index bca1f192805cc30b4eb748f6a4649e21cc873415..becf052f6f9a1312731c604f311b6865fe9ecdb1 100644 (file)
@@ -1,11 +1,5 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 from .common import InfoExtractor
-from ..utils import (
-    int_or_none,
-    try_get
-)
+from ..utils import int_or_none, try_get
 
 
 class OlympicsReplayIE(InfoExtractor):
@@ -19,9 +13,9 @@ class OlympicsReplayIE(InfoExtractor):
             'upload_date': '20210801',
             'timestamp': 1627783200,
             'description': 'md5:c66af4a5bc7429dbcc43d15845ff03b3',
+            'uploader': 'International Olympic Committee',
         },
         'params': {
-            'format': 'bestvideo',
             'skip_download': True,
         },
     }, {
@@ -30,9 +24,9 @@ class OlympicsReplayIE(InfoExtractor):
     }]
 
     def _real_extract(self, url):
-        id = self._match_id(url)
+        video_id = self._match_id(url)
 
-        webpage = self._download_webpage(url, id)
+        webpage = self._download_webpage(url, video_id)
         title = self._html_search_meta(('title', 'og:title', 'twitter:title'), webpage)
         uuid = self._html_search_meta('episode_uid', webpage)
         m3u8_url = self._html_search_meta('video_url', webpage)
@@ -52,20 +46,17 @@ def _real_extract(self, url):
             thumbnails.append({
                 'url': thumbnail,
                 'width': width,
-                'height': int_or_none(try_get(width, lambda x: x * height_a / width_a))
+                'height': int_or_none(try_get(width, lambda x: x * height_a / width_a)),
             })
         m3u8_url = self._download_json(
             f'https://olympics.com/tokenGenerator?url={m3u8_url}', uuid, note='Downloading m3u8 url')
-        formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, uuid, m3u8_id='hls')
-        self._sort_formats(formats)
+        formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, uuid, 'mp4', m3u8_id='hls')
 
         return {
             'id': uuid,
             'title': title,
-            'timestamp': json_ld.get('timestamp'),
-            'description': json_ld.get('description'),
             'thumbnails': thumbnails,
-            'duration': json_ld.get('duration'),
             'formats': formats,
             'subtitles': subtitles,
+            **json_ld,
         }