]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/redbee.py
[ie/orf:on] Improve extraction (#9677)
[yt-dlp.git] / yt_dlp / extractor / redbee.py
index 89a10448e13874f46a6941e2de2cfcf8a537bb70..4d71133b3cdd78643a38b0592ea46c64157f8eb5 100644 (file)
@@ -11,6 +11,7 @@
     int_or_none,
     strip_or_none,
     traverse_obj,
+    try_call,
     unified_timestamp,
 )
 
@@ -116,13 +117,10 @@ def _real_extract(self, url):
         video_id = self._match_id(url)
 
         formats, subtitles = self._get_formats_and_subtitles(video_id)
-        self._sort_formats(formats)
 
         video_info = self._download_json(
             f'https://www.parliamentlive.tv/Event/GetShareVideo/{video_id}', video_id, fatal=False)
 
-        self._sort_formats(formats, ['res', 'proto'])
-
         return {
             'id': video_id,
             'formats': formats,
@@ -131,10 +129,12 @@ def _real_extract(self, url):
             'thumbnail': traverse_obj(video_info, 'thumbnailUrl'),
             'timestamp': traverse_obj(
                 video_info, ('event', 'publishedStartTime'), expected_type=unified_timestamp),
+            '_format_sort_fields': ('res', 'proto'),
         }
 
 
 class RTBFIE(RedBeeBaseIE):
+    _WORKING = False
     _VALID_URL = r'''(?x)
         https?://(?:www\.)?rtbf\.be/
         (?:
@@ -255,7 +255,7 @@ def _get_formats_and_subtitles(self, url, media_id):
         if not login_token:
             self.raise_login_required()
 
-        session_jwt = self._download_json(
+        session_jwt = try_call(lambda: self._get_cookies(url)['rtbf_jwt'].value) or self._download_json(
             'https://login.rtbf.be/accounts.getJWT', media_id, query={
                 'login_token': login_token.value,
                 'APIKey': self._GIGYA_API_KEY,
@@ -365,7 +365,6 @@ def _real_extract(self, url):
             formats.extend(fmts)
             self._merge_subtitles(subs, target=subtitles)
 
-        self._sort_formats(formats, ['res', 'proto'])
         return {
             'id': media_id,
             'formats': formats,
@@ -377,4 +376,5 @@ def _real_extract(self, url):
             'series': data.get('programLabel'),
             'subtitles': subtitles,
             'is_live': is_live,
+            '_format_sort_fields': ('res', 'proto'),
         }