1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-11-11 03:55:14 +00:00

[ie/youtube] Restore convenience workarounds (#12181)

Authored by: bashonly
This commit is contained in:
bashonly
2025-01-25 10:18:15 -06:00
committed by GitHub
parent 6b91d232e3
commit f0d4b8a5d6
2 changed files with 14 additions and 1 deletions

View File

@@ -4030,6 +4030,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
raise ExtractorError('No player clients have been requested', expected=True)
if self.is_authenticated:
if (smuggled_data.get('is_music_url') or self.is_music_url(url)) and 'web_music' not in requested_clients:
requested_clients.append('web_music')
unsupported_clients = [
client for client in requested_clients if not INNERTUBE_CLIENTS[client]['SUPPORTS_COOKIES']
]
@@ -4169,6 +4172,16 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
else:
prs.append(pr)
# EU countries require age-verification for accounts to access age-restricted videos
# If account is not age-verified, _is_agegated() will be truthy for non-embedded clients
if self.is_authenticated and self._is_agegated(pr):
self.to_screen(
f'{video_id}: This video is age-restricted and YouTube is requiring '
'account age-verification; some formats may be missing', only_once=True)
# tv_embedded can work around the age-verification requirement for embeddable videos
# web_creator may work around age-verification for all videos but requires PO token
append_client('tv_embedded', 'web_creator')
prs.extend(deprioritized_prs)
if skipped_clients: