mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 04:10:23 +00:00
[extractor] Fix some errors being converted to ExtractorError
This commit is contained in:
parent
48f796874d
commit
0db3bae879
@ -74,6 +74,7 @@
|
|||||||
strip_or_none,
|
strip_or_none,
|
||||||
traverse_obj,
|
traverse_obj,
|
||||||
unescapeHTML,
|
unescapeHTML,
|
||||||
|
UnsupportedError,
|
||||||
unified_strdate,
|
unified_strdate,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
update_Request,
|
update_Request,
|
||||||
@ -604,10 +605,19 @@ def extract(self, url):
|
|||||||
if self.__maybe_fake_ip_and_retry(e.countries):
|
if self.__maybe_fake_ip_and_retry(e.countries):
|
||||||
continue
|
continue
|
||||||
raise
|
raise
|
||||||
|
except UnsupportedError:
|
||||||
|
raise
|
||||||
except ExtractorError as e:
|
except ExtractorError as e:
|
||||||
video_id = e.video_id or self.get_temp_id(url)
|
kwargs = {
|
||||||
raise ExtractorError(
|
'video_id': e.video_id or self.get_temp_id(url),
|
||||||
e.msg, video_id=video_id, ie=self.IE_NAME, tb=e.traceback, expected=e.expected, cause=e.cause)
|
'ie': self.IE_NAME,
|
||||||
|
'tb': e.traceback,
|
||||||
|
'expected': e.expected,
|
||||||
|
'cause': e.cause
|
||||||
|
}
|
||||||
|
if hasattr(e, 'countries'):
|
||||||
|
kwargs['countries'] = e.countries
|
||||||
|
raise type(e)(e.msg, **kwargs)
|
||||||
except compat_http_client.IncompleteRead as e:
|
except compat_http_client.IncompleteRead as e:
|
||||||
raise ExtractorError('A network error has occurred.', cause=e, expected=True, video_id=self.get_temp_id(url))
|
raise ExtractorError('A network error has occurred.', cause=e, expected=True, video_id=self.get_temp_id(url))
|
||||||
except (KeyError, StopIteration) as e:
|
except (KeyError, StopIteration) as e:
|
||||||
|
@ -2492,9 +2492,9 @@ class GeoRestrictedError(ExtractorError):
|
|||||||
geographic location due to geographic restrictions imposed by a website.
|
geographic location due to geographic restrictions imposed by a website.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, msg, countries=None):
|
def __init__(self, msg, countries=None, **kwargs):
|
||||||
super(GeoRestrictedError, self).__init__(msg, expected=True)
|
kwargs['expected'] = True
|
||||||
self.msg = msg
|
super(GeoRestrictedError, self).__init__(msg, **kwargs)
|
||||||
self.countries = countries
|
self.countries = countries
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user