]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/puhutv.py
[misc] Add `hatch`, `ruff`, `pre-commit` and improve dev docs (#7409)
[yt-dlp.git] / yt_dlp / extractor / puhutv.py
index ca71665e0fabf958738192b497130ee12d6ad1f6..fc4c29e95fea8f732c3f85d2b9938e1186a15f3d 100644 (file)
@@ -1,15 +1,10 @@
-# coding: utf-8
-from __future__ import unicode_literals
-
 from .common import InfoExtractor
-from ..compat import (
-    compat_HTTPError,
-    compat_str,
-)
+from ..compat import compat_str
+from ..networking.exceptions import HTTPError
 from ..utils import (
     ExtractorError,
-    int_or_none,
     float_or_none,
+    int_or_none,
     parse_resolution,
     str_or_none,
     try_get,
@@ -75,7 +70,7 @@ def _real_extract(self, url):
                 display_id, 'Downloading video JSON',
                 headers=self.geo_verification_headers())
         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:
                 self.raise_geo_restricted()
             raise
 
@@ -114,7 +109,6 @@ def _real_extract(self, url):
                 format_id += '-%sp' % quality
             f['format_id'] = format_id
             formats.append(f)
-        self._sort_formats(formats)
 
         creator = try_get(
             show, lambda x: x['producer']['name'], compat_str)