mirror of
https://github.com/yt-dlp/yt-dlp
synced 2024-12-26 21:59:08 +01:00
[ie/youtube] Support excluding player_client
s in extractor-arg (#10710)
Some checks failed
CodeQL / Analyze (python) (push) Has been cancelled
Download Tests / Quick Download Tests (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.10) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.11) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.12) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.10) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.8) (push) Has been cancelled
Download Tests / Full Download Tests (windows-latest, 3.8) (push) Has been cancelled
Download Tests / Full Download Tests (windows-latest, pypy-3.9) (push) Has been cancelled
Quick Test / Core Test (push) Has been cancelled
Quick Test / Code check (push) Has been cancelled
Release (master) / release (push) Has been cancelled
Some checks failed
CodeQL / Analyze (python) (push) Has been cancelled
Download Tests / Quick Download Tests (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.10) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.11) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, 3.12) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.10) (push) Has been cancelled
Download Tests / Full Download Tests (ubuntu-latest, pypy-3.8) (push) Has been cancelled
Download Tests / Full Download Tests (windows-latest, 3.8) (push) Has been cancelled
Download Tests / Full Download Tests (windows-latest, pypy-3.9) (push) Has been cancelled
Quick Test / Core Test (push) Has been cancelled
Quick Test / Code check (push) Has been cancelled
Release (master) / release (push) Has been cancelled
Closes #10699 Authored by: bashonly
This commit is contained in:
parent
a065086640
commit
49f3741a82
1 changed files with 12 additions and 4 deletions
|
@ -1339,6 +1339,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||
short_client_name(client): client
|
||||
for client in ('android', 'android_creator', 'android_music')
|
||||
}
|
||||
_DEFAULT_CLIENTS = ('ios', 'web_creator')
|
||||
|
||||
_GEO_BYPASS = False
|
||||
|
||||
|
@ -3744,17 +3745,19 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||
def _get_requested_clients(self, url, smuggled_data):
|
||||
requested_clients = []
|
||||
broken_clients = []
|
||||
default = ['ios', 'web_creator']
|
||||
excluded_clients = []
|
||||
allowed_clients = sorted(
|
||||
(client for client in INNERTUBE_CLIENTS if client[:1] != '_'),
|
||||
key=lambda client: INNERTUBE_CLIENTS[client]['priority'], reverse=True)
|
||||
for client in self._configuration_arg('player_client'):
|
||||
if client == 'default':
|
||||
requested_clients.extend(default)
|
||||
requested_clients.extend(self._DEFAULT_CLIENTS)
|
||||
elif client == 'all':
|
||||
requested_clients.extend(allowed_clients)
|
||||
elif client.startswith('-'):
|
||||
excluded_clients.append(client[1:])
|
||||
elif client not in allowed_clients:
|
||||
self.report_warning(f'Skipping unsupported client {client}')
|
||||
self.report_warning(f'Skipping unsupported client "{client}"')
|
||||
elif client in self._BROKEN_CLIENTS.values():
|
||||
broken_clients.append(client)
|
||||
else:
|
||||
|
@ -3762,7 +3765,12 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||
# Force deprioritization of _BROKEN_CLIENTS for format de-duplication
|
||||
requested_clients.extend(broken_clients)
|
||||
if not requested_clients:
|
||||
requested_clients = default
|
||||
requested_clients.extend(self._DEFAULT_CLIENTS)
|
||||
for excluded_client in excluded_clients:
|
||||
if excluded_client in requested_clients:
|
||||
requested_clients.remove(excluded_client)
|
||||
if not requested_clients:
|
||||
raise ExtractorError('No player clients have been requested', expected=True)
|
||||
|
||||
if smuggled_data.get('is_music_url') or self.is_music_url(url):
|
||||
for requested_client in requested_clients:
|
||||
|
|
Loading…
Reference in a new issue