]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/viidea.py
[ie/crunchyroll] Fix stream extraction (#10005)
[yt-dlp.git] / yt_dlp / extractor / viidea.py
index a0abbae60fee59fda14d8cf7ac5a235a3df7472d..649ffe395b47b87639c3862f68ed0f74f47ac34e 100644 (file)
@@ -1,13 +1,11 @@
-from __future__ import unicode_literals
-
 import re
 
 from .common import InfoExtractor
 from ..compat import (
-    compat_HTTPError,
     compat_str,
     compat_urlparse,
 )
+from ..networking.exceptions import HTTPError
 from ..utils import (
     ExtractorError,
     js_to_json,
@@ -117,7 +115,7 @@ class ViideaIE(InfoExtractor):
     }]
 
     def _real_extract(self, url):
-        lecture_slug, explicit_part_id = re.match(self._VALID_URL, url).groups()
+        lecture_slug, explicit_part_id = self._match_valid_url(url).groups()
 
         webpage = self._download_webpage(url, lecture_slug)
 
@@ -135,9 +133,9 @@ def _real_extract(self, url):
                 '%s/site/api/lecture/%s?format=json' % (base_url, lecture_id),
                 lecture_id)['lecture'][0]
         except ExtractorError as e:
-            if isinstance(e.cause, compat_HTTPError) and e.cause.code == 403:
+            if isinstance(e.cause, HTTPError) and e.cause.status == 403:
                 msg = self._parse_json(
-                    e.cause.read().decode('utf-8'), lecture_id)
+                    e.cause.response.read().decode('utf-8'), lecture_id)
                 raise ExtractorError(msg['detail'], expected=True)
             raise
 
@@ -160,7 +158,6 @@ def extract_part(part_id):
                 smil_url = '%s/%s/video/%s/smil.xml' % (base_url, lecture_slug, part_id)
                 smil = self._download_smil(smil_url, lecture_id)
                 info = self._parse_smil(smil, smil_url, lecture_id)
-                self._sort_formats(info['formats'])
                 info['id'] = lecture_id if not multipart else '%s_part%s' % (lecture_id, part_id)
                 info['display_id'] = lecture_slug if not multipart else '%s_part%s' % (lecture_slug, part_id)
                 if multipart: