]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/filmon.py
[ie/crunchyroll] Fix stream extraction (#10005)
[yt-dlp.git] / yt_dlp / extractor / filmon.py
index 7b43ecc0f975607e80b13d7aaa3ffd7ec76e1af4..0cd18f49479aad7738f8237ac59a37e72480c5bb 100644 (file)
@@ -1,11 +1,6 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 from .common import InfoExtractor
-from ..compat import (
-    compat_str,
-    compat_HTTPError,
-)
+from ..compat import compat_str
+from ..networking.exceptions import HTTPError
 from ..utils import (
     qualities,
     strip_or_none,
@@ -43,8 +38,8 @@ def _real_extract(self, url):
                 'https://www.filmon.com/api/vod/movie?id=%s' % video_id,
                 video_id)['response']
         except ExtractorError as e:
-            if isinstance(e.cause, compat_HTTPError):
-                errmsg = self._parse_json(e.cause.read().decode(), video_id)['reason']
+            if isinstance(e.cause, HTTPError):
+                errmsg = self._parse_json(e.cause.response.read().decode(), video_id)['reason']
                 raise ExtractorError('%s said: %s' % (self.IE_NAME, errmsg), expected=True)
             raise
 
@@ -68,7 +63,6 @@ def _real_extract(self, url):
                 'quality': QUALITY(stream.get('quality')),
                 'protocol': 'm3u8_native',
             })
-        self._sort_formats(formats)
 
         thumbnails = []
         poster = response.get('poster', {})
@@ -128,8 +122,8 @@ def _real_extract(self, url):
             channel_data = self._download_json(
                 'http://www.filmon.com/api-v2/channel/' + channel_id, channel_id)['data']
         except ExtractorError as e:
-            if isinstance(e.cause, compat_HTTPError):
-                errmsg = self._parse_json(e.cause.read().decode(), channel_id)['message']
+            if isinstance(e.cause, HTTPError):
+                errmsg = self._parse_json(e.cause.response.read().decode(), channel_id)['message']
                 raise ExtractorError('%s said: %s' % (self.IE_NAME, errmsg), expected=True)
             raise
 
@@ -156,7 +150,6 @@ def _real_extract(self, url):
                 'ext': 'mp4',
                 'quality': QUALITY(quality),
             })
-        self._sort_formats(formats)
 
         thumbnails = []
         for name, width, height in self._THUMBNAIL_RES: