]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/beeg.py
[cleanup] Add more ruff rules (#10149)
[yt-dlp.git] / yt_dlp / extractor / beeg.py
index 717fff3a680713eb30d2b8acb232f0bf4f2038eb..960cdfabdd3fad4fb972cdd56dfc4625a04c7bf3 100644 (file)
@@ -1,9 +1,7 @@
-from __future__ import unicode_literals
-
 from .common import InfoExtractor
-
 from ..utils import (
     int_or_none,
+    str_or_none,
     traverse_obj,
     try_get,
     unified_timestamp,
@@ -24,8 +22,8 @@ class BeegIE(InfoExtractor):
             'age_limit': 18,
             'upload_date': '20220131',
             'timestamp': 1643656455,
-            'display_id': 2540839,
-        }
+            'display_id': '2540839',
+        },
     }, {
         'url': 'https://beeg.com/-0599050563103750?t=4-861',
         'md5': 'bd8b5ea75134f7f07fad63008db2060e',
@@ -38,9 +36,9 @@ class BeegIE(InfoExtractor):
             'age_limit': 18,
             'description': 'md5:b4fc879a58ae6c604f8f259155b7e3b9',
             'timestamp': 1643623200,
-            'display_id': 2569965,
+            'display_id': '2569965',
             'upload_date': '20220131',
-        }
+        },
     }, {
         # api/v6 v2
         'url': 'https://beeg.com/1941093077?t=911-1391',
@@ -57,8 +55,8 @@ def _real_extract(self, url):
         webpage = self._download_webpage(url, video_id)
 
         video = self._download_json(
-            'https://store.externulls.com/facts/file/%s' % video_id,
-            video_id, 'Downloading JSON for %s' % video_id)
+            f'https://store.externulls.com/facts/file/{video_id}',
+            video_id, f'Downloading JSON for {video_id}')
 
         fc_facts = video.get('fc_facts')
         first_fact = {}
@@ -78,11 +76,9 @@ def _real_extract(self, url):
                 f['height'] = height
             formats.extend(current_formats)
 
-        self._sort_formats(formats)
-
         return {
             'id': video_id,
-            'display_id': first_fact.get('id'),
+            'display_id': str_or_none(first_fact.get('id')),
             'title': traverse_obj(video, ('file', 'stuff', 'sf_name')),
             'description': traverse_obj(video, ('file', 'stuff', 'sf_story')),
             'timestamp': unified_timestamp(first_fact.get('fc_created')),