]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/streamcz.py
[ie/crunchyroll] Fix stream extraction (#10005)
[yt-dlp.git] / yt_dlp / extractor / streamcz.py
index 4cb9923e2cb8732c3b3534e2c8e9f58cae1fb086..c4537ba8df8a058d8687e43d4fb89b33811b2fe4 100644 (file)
@@ -1,4 +1,3 @@
-# coding: utf-8
 import json
 
 from .common import InfoExtractor
@@ -53,8 +52,8 @@ class StreamCZIE(InfoExtractor):
 
     def _extract_formats(self, spl_url, video):
         for ext, pref, streams in (
-                ('ts', -1, traverse_obj(video, ('http_stream', 'qualities'))),
-                ('mp4', 1, video.get('mp4'))):
+                ('ts', -1, traverse_obj(video, ('http_stream', 'qualities')) or {}),
+                ('mp4', 1, video.get('mp4') or {})):
             for format_id, stream in streams.items():
                 if not stream.get('url'):
                     continue
@@ -110,7 +109,6 @@ def _real_extract(self, url):
                 })
 
         formats = list(self._extract_formats(spl_url, video))
-        self._sort_formats(formats)
 
         return {
             'id': video_id,