Fix default clients when using oauth

This commit is contained in:
coletdjnz 2024-09-14 13:12:28 +12:00
parent 5948815529
commit da9490259a
No known key found for this signature in database
GPG key ID: 91984263BB39894A

View file

@ -1513,6 +1513,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
} }
_SUBTITLE_FORMATS = ('json3', 'srv1', 'srv2', 'srv3', 'ttml', 'vtt') _SUBTITLE_FORMATS = ('json3', 'srv1', 'srv2', 'srv3', 'ttml', 'vtt')
_DEFAULT_CLIENTS = ('ios', 'web_creator') _DEFAULT_CLIENTS = ('ios', 'web_creator')
_DEFAULT_CLIENTS_OAUTH = ('ios', 'mweb')
_GEO_BYPASS = False _GEO_BYPASS = False
@ -3979,9 +3980,10 @@ def _get_requested_clients(self, url, smuggled_data):
allowed_clients = sorted( allowed_clients = sorted(
(client for client in INNERTUBE_CLIENTS if client[:1] != '_'), (client for client in INNERTUBE_CLIENTS if client[:1] != '_'),
key=lambda client: INNERTUBE_CLIENTS[client]['priority'], reverse=True) key=lambda client: INNERTUBE_CLIENTS[client]['priority'], reverse=True)
default_clients = self._DEFAULT_CLIENTS if not self._OAUTH_USER else self._DEFAULT_CLIENTS_OAUTH
for client in self._configuration_arg('player_client'): for client in self._configuration_arg('player_client'):
if client == 'default': if client == 'default':
requested_clients.extend(self._DEFAULT_CLIENTS) requested_clients.extend(default_clients)
elif client == 'all': elif client == 'all':
requested_clients.extend(allowed_clients) requested_clients.extend(allowed_clients)
elif client.startswith('-'): elif client.startswith('-'):
@ -3991,7 +3993,7 @@ def _get_requested_clients(self, url, smuggled_data):
else: else:
requested_clients.append(client) requested_clients.append(client)
if not requested_clients: if not requested_clients:
requested_clients.extend(self._DEFAULT_CLIENTS) requested_clients.extend(default_clients)
for excluded_client in excluded_clients: for excluded_client in excluded_clients:
if excluded_client in requested_clients: if excluded_client in requested_clients:
requested_clients.remove(excluded_client) requested_clients.remove(excluded_client)