Fix doubling of video_id in ExtractorError

This commit is contained in:
pukkandan 2022-03-04 19:37:43 +05:30
parent 3a4bb9f751
commit 7265a2190c
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
2 changed files with 4 additions and 3 deletions

View file

@ -639,7 +639,7 @@ def extract(self, url):
} }
if hasattr(e, 'countries'): if hasattr(e, 'countries'):
kwargs['countries'] = e.countries kwargs['countries'] = e.countries
raise type(e)(e.msg, **kwargs) raise type(e)(e.orig_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:
@ -1101,6 +1101,7 @@ def raise_login_required(
if metadata_available and ( if metadata_available and (
self.get_param('ignore_no_formats_error') or self.get_param('wait_for_video')): self.get_param('ignore_no_formats_error') or self.get_param('wait_for_video')):
self.report_warning(msg) self.report_warning(msg)
return
if method is not None: if method is not None:
msg = '%s. %s' % (msg, self._LOGIN_HINTS[method]) msg = '%s. %s' % (msg, self._LOGIN_HINTS[method])
raise ExtractorError(msg, expected=True) raise ExtractorError(msg, expected=True)

View file

@ -1060,7 +1060,7 @@ def __init__(self, msg, tb=None, expected=False, cause=None, video_id=None, ie=N
if sys.exc_info()[0] in network_exceptions: if sys.exc_info()[0] in network_exceptions:
expected = True expected = True
self.msg = str(msg) self.orig_msg = str(msg)
self.traceback = tb self.traceback = tb
self.expected = expected self.expected = expected
self.cause = cause self.cause = cause
@ -1071,7 +1071,7 @@ def __init__(self, msg, tb=None, expected=False, cause=None, video_id=None, ie=N
super(ExtractorError, self).__init__(''.join(( super(ExtractorError, self).__init__(''.join((
format_field(ie, template='[%s] '), format_field(ie, template='[%s] '),
format_field(video_id, template='%s: '), format_field(video_id, template='%s: '),
self.msg, msg,
format_field(cause, template=' (caused by %r)'), format_field(cause, template=' (caused by %r)'),
'' if expected else bug_reports_message()))) '' if expected else bug_reports_message())))