Compare commits

..

No commits in common. "9bcfe33be7f1aa7164e690ced133cae4b063efa4" and "a9d069f5b8540f15caaf696bc39ce6a969f8b11c" have entirely different histories.

3 changed files with 17 additions and 20 deletions

View file

@ -692,10 +692,16 @@ def extract(self, url):
except UnsupportedError: except UnsupportedError:
raise raise
except ExtractorError as e: except ExtractorError as e:
e.video_id = e.video_id or self.get_temp_id(url), kwargs = {
e.ie = e.ie or self.IE_NAME, 'video_id': e.video_id or self.get_temp_id(url),
e.traceback = e.traceback or sys.exc_info()[2] 'ie': self.IE_NAME,
raise 'tb': e.traceback or sys.exc_info()[2],
'expected': e.expected,
'cause': e.cause
}
if hasattr(e, 'countries'):
kwargs['countries'] = e.countries
raise type(e)(e.orig_msg, **kwargs)
except http.client.IncompleteRead as e: except 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:

View file

@ -4085,7 +4085,7 @@ def process_language(container, base_url, lang_code, sub_name, query):
if not trans_code: if not trans_code:
continue continue
orig_trans_code = trans_code orig_trans_code = trans_code
if caption_track.get('kind') != 'asr' and trans_code != 'und': if caption_track.get('kind') != 'asr':
if not get_translated_subs: if not get_translated_subs:
continue continue
trans_code += f'-{lang_code}' trans_code += f'-{lang_code}'

View file

@ -1095,16 +1095,13 @@ def __init__(self, msg, tb=None, expected=False, cause=None, video_id=None, ie=N
self.exc_info = sys.exc_info() # preserve original exception self.exc_info = sys.exc_info() # preserve original exception
if isinstance(self.exc_info[1], ExtractorError): if isinstance(self.exc_info[1], ExtractorError):
self.exc_info = self.exc_info[1].exc_info self.exc_info = self.exc_info[1].exc_info
super().__init__(self.__msg)
@property super().__init__(''.join((
def __msg(self): format_field(ie, None, '[%s] '),
return ''.join(( format_field(video_id, None, '%s: '),
format_field(self.ie, None, '[%s] '), msg,
format_field(self.video_id, None, '%s: '), format_field(cause, None, ' (caused by %r)'),
self.orig_msg, '' if expected else bug_reports_message())))
format_field(self.cause, None, ' (caused by %r)'),
'' if self.expected else bug_reports_message()))
def format_traceback(self): def format_traceback(self):
return join_nonempty( return join_nonempty(
@ -1112,12 +1109,6 @@ def format_traceback(self):
self.cause and ''.join(traceback.format_exception(None, self.cause, self.cause.__traceback__)[1:]), self.cause and ''.join(traceback.format_exception(None, self.cause, self.cause.__traceback__)[1:]),
delim='\n') or None delim='\n') or None
def __setattr__(self, name, value):
super().__setattr__(name, value)
if getattr(self, 'msg', None) and name not in ('msg', 'args'):
self.msg = self.__msg or type(self).__name__
self.args = (self.msg, ) # Cannot be property
class UnsupportedError(ExtractorError): class UnsupportedError(ExtractorError):
def __init__(self, url): def __init__(self, url):