]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/rai.py
[extractor/vimeo] Fix `playerConfig` extraction (#6203)
[yt-dlp.git] / yt_dlp / extractor / rai.py
index dc911069dc46248235e180218b9cc45e820910a4..cab12cc214a0b64788cb4aeb9fc7b3e4d6056292 100644 (file)
@@ -156,7 +156,7 @@ def get_format_info(tbr):
             br = int_or_none(tbr)
             if len(fmts) == 1 and not br:
                 br = fmts[0].get('tbr')
-            if br or 0 > 300:
+            if br and br > 300:
                 tbr = compat_str(math.floor(br / 100) * 100)
             else:
                 tbr = '250'
@@ -313,7 +313,6 @@ def _real_extract(self, url):
         video = media['video']
 
         relinker_info = self._extract_relinker_info(video['content_url'], video_id)
-        self._sort_formats(relinker_info['formats'])
 
         thumbnails = []
         for _, value in media.get('images', {}).items():
@@ -356,7 +355,7 @@ def _real_extract(self, url):
         }
 
 
-class RaiPlayLiveIE(RaiPlayIE):
+class RaiPlayLiveIE(RaiPlayIE):  # XXX: Do not subclass from concrete IE
     _VALID_URL = r'(?P<base>https?://(?:www\.)?raiplay\.it/dirette/(?P<id>[^/?#&]+))'
     _TESTS = [{
         'url': 'http://www.raiplay.it/dirette/rainews24',
@@ -504,7 +503,7 @@ def _real_extract(self, url):
         }
 
 
-class RaiPlaySoundLiveIE(RaiPlaySoundIE):
+class RaiPlaySoundLiveIE(RaiPlaySoundIE):  # XXX: Do not subclass from concrete IE
     _VALID_URL = r'(?P<base>https?://(?:www\.)?raiplaysound\.it/(?P<id>[^/?#&]+)$)'
     _TESTS = [{
         'url': 'https://www.raiplaysound.it/radio2',
@@ -621,8 +620,6 @@ def _extract_from_content_id(self, content_id, url):
         else:
             raise ExtractorError('not a media file')
 
-        self._sort_formats(relinker_info['formats'])
-
         thumbnails = []
         for image_type in ('image', 'image_medium', 'image_300'):
             thumbnail_url = media.get(image_type)
@@ -703,7 +700,6 @@ def _real_extract(self, url):
 
         relinker_info = self._extract_relinker_info(
             urljoin(url, relinker_url), video_id)
-        self._sort_formats(relinker_info['formats'])
 
         title = self._search_regex(
             r'var\s+videoTitolo\s*=\s*([\'"])(?P<title>[^\'"]+)\1',
@@ -717,7 +713,7 @@ def _real_extract(self, url):
         }
 
 
-class RaiNewsIE(RaiIE):
+class RaiNewsIE(RaiIE):  # XXX: Do not subclass from concrete IE
     _VALID_URL = rf'https?://(www\.)?rainews\.it/(?!articoli)[^?#]+-(?P<id>{RaiBaseIE._UUID_RE})(?:-[^/?#]+)?\.html'
     _EMBED_REGEX = [rf'<iframe[^>]+data-src="(?P<url>/iframe/[^?#]+?{RaiBaseIE._UUID_RE}\.html)']
     _TESTS = [{
@@ -772,8 +768,6 @@ def _real_extract(self, url):
 
         relinker_info = self._extract_relinker_info(urljoin(url, relinker_url), video_id)
 
-        self._sort_formats(relinker_info['formats'])
-
         return {
             'id': video_id,
             'title': track_info.get('title') or self._og_search_title(webpage),