Better error mesage when "sign in" is required

Authored by: bashonly
This commit is contained in:
bashonly 2024-11-15 11:55:37 -06:00
parent ac987127ae
commit 065340088c
No known key found for this signature in database
GPG Key ID: 783F096F253D15B0

View File

@ -851,7 +851,11 @@ def _report_alerts(self, alerts, expected=True, fatal=True, only_once=False):
for alert_type, alert_message in (warnings + errors[:-1]): for alert_type, alert_message in (warnings + errors[:-1]):
self.report_warning(f'YouTube said: {alert_type} - {alert_message}', only_once=only_once) self.report_warning(f'YouTube said: {alert_type} - {alert_message}', only_once=only_once)
if errors: if errors:
raise ExtractorError(f'YouTube said: {errors[-1][1]}', expected=expected) msg = errors[-1][1]
if msg and 'sign in' in msg.lower():
expected = True
msg += '\n' + self._youtube_login_hint
raise ExtractorError(f'YouTube said: {msg}', expected=expected)
def _extract_and_report_alerts(self, data, *args, **kwargs): def _extract_and_report_alerts(self, data, *args, **kwargs):
return self._report_alerts(self._extract_alerts(data), *args, **kwargs) return self._report_alerts(self._extract_alerts(data), *args, **kwargs)