]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/shahid.py
[ie/youtube] Extract upload timestamp if available (#9856)
[yt-dlp.git] / yt_dlp / extractor / shahid.py
index 53ca86b73e0cf0304b436ef64a081e222878def4..89aee27280005f56c08db1ae198833ad3f1e246a 100644 (file)
@@ -3,11 +3,11 @@
 import re
 
 from .aws import AWSIE
-from ..compat import compat_HTTPError
+from ..networking.exceptions import HTTPError
 from ..utils import (
-    clean_html,
     ExtractorError,
     InAdvancePagedList,
+    clean_html,
     int_or_none,
     parse_iso8601,
     str_or_none,
@@ -22,7 +22,7 @@ class ShahidBaseIE(AWSIE):
 
     def _handle_error(self, e):
         fail_data = self._parse_json(
-            e.cause.read().decode('utf-8'), None, fatal=False)
+            e.cause.response.read().decode('utf-8'), None, fatal=False)
         if fail_data:
             faults = fail_data.get('faults', [])
             faults_message = ', '.join([clean_html(fault['userMessage']) for fault in faults if fault.get('userMessage')])
@@ -40,7 +40,7 @@ def _call_api(self, path, video_id, request=None):
                 'secret_key': '4WUUJWuFvtTkXbhaWTDv7MhO+0LqoYDWfEnUXoWn',
             }, video_id, query)
         except ExtractorError as e:
-            if isinstance(e.cause, compat_HTTPError):
+            if isinstance(e.cause, HTTPError):
                 self._handle_error(e)
             raise
 
@@ -88,7 +88,7 @@ def _perform_login(self, username, password):
                     'Content-Type': 'application/json; charset=UTF-8',
                 })['user']
         except ExtractorError as e:
-            if isinstance(e.cause, compat_HTTPError):
+            if isinstance(e.cause, HTTPError):
                 self._handle_error(e)
             raise
 
@@ -118,7 +118,6 @@ def _real_extract(self, url):
             # https://docs.aws.amazon.com/mediapackage/latest/ug/manifest-filtering.html
             r'aws\.manifestfilter=[\w:;,-]+&?',
             '', playout['url']), video_id, 'mp4')
-        self._sort_formats(formats)
 
         # video = self._call_api(
         #     'product/id', video_id, {