]> jfr.im git - yt-dlp.git/blobdiff - yt_dlp/extractor/youtube.py
[youtube] Add `player_client=all`
[yt-dlp.git] / yt_dlp / extractor / youtube.py
index 385ba34f9c750c547ef22f4bf9942cd28d0a3620..fe0e7f38dc61816e7a30631bf2dbe1b268700190 100644 (file)
@@ -451,10 +451,6 @@ def _real_initialize(self):
 
     # clients starting with _ cannot be explicity requested by the user
     _YT_CLIENTS = {
-        'web': 'WEB',
-        'web_music': 'WEB_REMIX',
-        '_web_embedded': 'WEB_EMBEDDED_PLAYER',
-        '_web_agegate': 'TVHTML5',
         'android': 'ANDROID',
         'android_music': 'ANDROID_MUSIC',
         '_android_embedded': 'ANDROID_EMBEDDED_PLAYER',
@@ -462,7 +458,11 @@ def _real_initialize(self):
         'ios': 'IOS',
         'ios_music': 'IOS_MUSIC',
         '_ios_embedded': 'IOS_MESSAGES_EXTENSION',
-        '_ios_agegate': 'IOS'
+        '_ios_agegate': 'IOS',
+        'web': 'WEB',
+        'web_music': 'WEB_REMIX',
+        '_web_embedded': 'WEB_EMBEDDED_PLAYER',
+        '_web_agegate': 'TVHTML5',
     }
 
     def _get_default_ytcfg(self, client='WEB'):
@@ -2430,8 +2430,15 @@ def _extract_age_gated_player_response(self, client, video_id, ytcfg, identity_t
             identity_token, player_url, initial_pr)
 
     def _get_requested_clients(self, url, smuggled_data):
-        requested_clients = [client for client in self._configuration_arg('player_client')
-                             if client[:0] != '_' and client in self._YT_CLIENTS]
+        requested_clients = []
+        allowed_clients = [client for client in self._YT_CLIENTS.keys() if client[:1] != '_']
+        for client in self._configuration_arg('player_client'):
+            if client in allowed_clients:
+                requested_clients.append(client)
+            elif client == 'all':
+                requested_clients.extend(allowed_clients)
+            else:
+                self.report_warning(f'Skipping unsupported client {client}')
         if not requested_clients:
             requested_clients = ['android', 'web']