]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/playplustv.py
[ie/crunchyroll] Fix stream extraction (#10005)
[yt-dlp.git] / yt_dlp / extractor / playplustv.py
index cad2c3a0f4d75f9301476d71623547b3e1c50a97..a4439c8bc53af125d503a959539af3016c2258fa 100644 (file)
@@ -1,16 +1,9 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 import json
 
 from .common import InfoExtractor
-from ..compat import compat_HTTPError
-from ..utils import (
-    clean_html,
-    ExtractorError,
-    int_or_none,
-    PUTRequest,
-)
+from ..networking import PUTRequest
+from ..networking.exceptions import HTTPError
+from ..utils import ExtractorError, clean_html, int_or_none
 
 
 class PlayPlusTVIE(InfoExtractor):
@@ -50,9 +43,9 @@ def _perform_login(self, username, password):
         try:
             self._token = self._download_json(req, None)['token']
         except ExtractorError as e:
-            if isinstance(e.cause, compat_HTTPError) and e.cause.code == 401:
+            if isinstance(e.cause, HTTPError) and e.cause.status == 401:
                 raise ExtractorError(self._parse_json(
-                    e.cause.read(), None)['errorMessage'], expected=True)
+                    e.cause.response.read(), None)['errorMessage'], expected=True)
             raise
 
         self._profile = self._call_api('Profiles')['list'][0]['_id']
@@ -82,7 +75,6 @@ def _real_extract(self, url):
                 'width': int_or_none(file_info.get('width')),
                 'height': int_or_none(file_info.get('height')),
             })
-        self._sort_formats(formats)
 
         thumbnails = []
         for thumb in media.get('thumbs', []):