Actually improve "sign in" error messages

Authored by: bashonly
This commit is contained in:
bashonly 2024-11-15 14:18:15 -06:00
parent a201e444b6
commit b338b39244
No known key found for this signature in database
GPG Key ID: 783F096F253D15B0

View File

@ -50,6 +50,7 @@ from ..utils import (
parse_iso8601,
parse_qs,
qualities,
remove_end,
remove_start,
smuggle_url,
str_or_none,
@ -4461,6 +4462,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
self.raise_geo_restricted(subreason, countries, metadata_available=True)
reason += f'. {subreason}'
if reason:
if 'sign in' in reason.lower():
reason = remove_end(reason, ' This helps protect our community. Learn more')
reason = f'{remove_end(reason.strip(), ".")}. {self._youtube_login_hint}'
self.raise_no_formats(reason, expected=True)
keywords = get_first(video_details, 'keywords', expected_type=list) or []