From 7265a2190c46b7312669d613898055c2b080d26e Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 4 Mar 2022 19:37:43 +0530 Subject: [PATCH] Fix doubling of `video_id` in `ExtractorError` --- yt_dlp/extractor/common.py | 3 ++- yt_dlp/utils.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 53b21ece6..6c1fe55f8 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -639,7 +639,7 @@ class InfoExtractor(object): } if hasattr(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: raise ExtractorError('A network error has occurred.', cause=e, expected=True, video_id=self.get_temp_id(url)) except (KeyError, StopIteration) as e: @@ -1101,6 +1101,7 @@ class InfoExtractor(object): if metadata_available and ( self.get_param('ignore_no_formats_error') or self.get_param('wait_for_video')): self.report_warning(msg) + return if method is not None: msg = '%s. %s' % (msg, self._LOGIN_HINTS[method]) raise ExtractorError(msg, expected=True) diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py index 5eb049ab7..4134acfdc 100644 --- a/yt_dlp/utils.py +++ b/yt_dlp/utils.py @@ -1060,7 +1060,7 @@ class ExtractorError(YoutubeDLError): if sys.exc_info()[0] in network_exceptions: expected = True - self.msg = str(msg) + self.orig_msg = str(msg) self.traceback = tb self.expected = expected self.cause = cause @@ -1071,7 +1071,7 @@ class ExtractorError(YoutubeDLError): super(ExtractorError, self).__init__(''.join(( format_field(ie, template='[%s] '), format_field(video_id, template='%s: '), - self.msg, + msg, format_field(cause, template=' (caused by %r)'), '' if expected else bug_reports_message())))