aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/mgtv.py
diff options
context:
space:
mode:
Diffstat (limited to 'yt_dlp/extractor/mgtv.py')
-rw-r--r--yt_dlp/extractor/mgtv.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/yt_dlp/extractor/mgtv.py b/yt_dlp/extractor/mgtv.py
index 06edcb396..31ccf004e 100644
--- a/yt_dlp/extractor/mgtv.py
+++ b/yt_dlp/extractor/mgtv.py
@@ -1,9 +1,9 @@
import base64
import time
-import urllib.error
import uuid
from .common import InfoExtractor
+from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
int_or_none,
@@ -86,8 +86,8 @@ class MGTVIE(InfoExtractor):
'type': 'pch5'
}, headers=self.geo_verification_headers())['data']
except ExtractorError as e:
- if isinstance(e.cause, urllib.error.HTTPError) and e.cause.code == 401:
- error = self._parse_json(e.cause.read().decode(), None)
+ if isinstance(e.cause, HTTPError) and e.cause.status == 401:
+ error = self._parse_json(e.cause.response.read().decode(), None)
if error.get('code') == 40005:
self.raise_geo_restricted(countries=self._GEO_COUNTRIES)
raise ExtractorError(error['msg'], expected=True)