Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/youtube.py (Python)

Code before:
                        return

        tried_iframe_fallback = False
        player_url = None
        skipped_clients = {}
        while clients:
            client, base_client, variant = _split_innertube_client(clients.pop())
            player_ytcfg = master_ytcfg if client == 'web' else {}
            if 'configs' not in self._configuration_arg('player_skip') and client != 'web':
                player_ytcfg = self._download_ytcfg(client, video_id) or player_ytcfg

            player_url = player_url or self._extract_player_url(master_ytcfg, player_ytcfg, webpage=webpage)
            require_js_player = self._get_default_ytcfg(client).get('REQUIRE_JS_PLAYER')
            if 'js' in self._configuration_arg('player_skip'):
                require_js_player = False
                player_url = None

            if not player_url and not tried_iframe_fallback and require_js_player:
                player_url = self._download_player_url(video_id)
                tried_iframe_fallback = True

            pr = None
            for retry in self.RetryManager(fatal=False):
                try:
                    pr = initial_pr if client == 'web' and initial_pr else self._extract_player_response(
                        client, video_id, player_ytcfg or master_ytcfg, player_ytcfg, player_url if require_js_player else None, initial_pr, smuggled_data)
                except ExtractorError as e:
                    self.report_warning(e)
                    break
                experiments = traverse_obj(pr, (
                    'responseContext', 'serviceTrackingParams', lambda _, v: v['service'] == 'GFEEDBACK',
                    'params', lambda _, v: v['key'] == 'e', 'value', {lambda x: x.split(',')}, ..., {str}))
                if all(x in experiments for x in self._POTOKEN_EXPERIMENTS):
                    pr = None
                    retry.error = ExtractorError('API returned broken formats due to PO token experiment', expected=True)
            if not pr:
                continue

            if pr_id := self._invalid_player_response(pr, video_id):
                skipped_clients[client] = pr_id
            elif pr:
                # Save client name for introspection later
                name = short_client_name(client)
                sd = traverse_obj(pr, ('streamingData', {dict})) or {}
                sd[STREAMING_DATA_CLIENT_NAME] = name
                for f in traverse_obj(sd, (('formats', 'adaptiveFormats'), ..., {dict})):
                    f[STREAMING_DATA_CLIENT_NAME] = name
                prs.append(pr)

            # creator clients can bypass AGE_VERIFICATION_REQUIRED if logged in
            if variant == 'embedded' and self._is_unplayable(pr) and self.is_authenticated:

Review comment (refactor):
```suggestion
            pr = initial_pr if client == 'web' and initial_pr else None
            for retry in self.RetryManager(fatal=False):
                try:
                    pr = pr or self._extract_player_response(
                        client, video_id, player_ytcfg or master_ytcfg, player_ytcfg,
                        player_url if require_js_player else None, initial_pr, smuggled_data)
```

Code after:
                        return

        tried_iframe_fallback = False
        player_url = None
        skipped_clients = {}
        while clients:
            client, base_client, variant = _split_innertube_client(clients.pop())
            player_ytcfg = master_ytcfg if client == 'web' else {}
            if 'configs' not in self._configuration_arg('player_skip') and client != 'web':
                player_ytcfg = self._download_ytcfg(client, video_id) or player_ytcfg

            player_url = player_url or self._extract_player_url(master_ytcfg, player_ytcfg, webpage=webpage)
            require_js_player = self._get_default_ytcfg(client).get('REQUIRE_JS_PLAYER')
            if 'js' in self._configuration_arg('player_skip'):
                require_js_player = False
                player_url = None

            if not player_url and not tried_iframe_fallback and require_js_player:
                player_url = self._download_player_url(video_id)
                tried_iframe_fallback = True

            pr = initial_pr if client == 'web' and initial_pr else None
            for retry in self.RetryManager(fatal=False):
                try:
                    pr = pr or self._extract_player_response(
                        client, video_id, player_ytcfg or master_ytcfg, player_ytcfg,
                        player_url if require_js_player else None, initial_pr, smuggled_data)
                except ExtractorError as e:
                    self.report_warning(e)
                    break
                experiments = traverse_obj(pr, (
                    'responseContext', 'serviceTrackingParams', lambda _, v: v['service'] == 'GFEEDBACK',
                    'params', lambda _, v: v['key'] == 'e', 'value', {lambda x: x.split(',')}, ..., {str}))
                if all(x in experiments for x in self._POTOKEN_EXPERIMENTS):
                    pr = None
                    retry.error = ExtractorError('API returned broken formats (poToken experiment detected)', expected=True)
            if not pr:
                continue

            if pr_id := self._invalid_player_response(pr, video_id):
                skipped_clients[client] = pr_id
            elif pr:
                # Save client name for introspection later
                name = short_client_name(client)
                sd = traverse_obj(pr, ('streamingData', {dict})) or {}
                sd[STREAMING_DATA_CLIENT_NAME] = name
                for f in traverse_obj(sd, (('formats', 'adaptiveFormats'), ..., {dict})):
                    f[STREAMING_DATA_CLIENT_NAME] = name
                prs.append(pr)

            # creator clients can bypass AGE_VERIFICATION_REQUIRED if logged in