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

Code before:
                'uploader_id': ('upData', 'mid', {str_or_none}),
                'like_count': ('videoData', 'stat', 'like', {int_or_none}),
                'tags': ('tags', ..., 'tag_name'),
                'thumbnail': ('videoData', 'pic', {url_or_none}),
            }),
            **festival_info,
            **traverse_obj(video_data, {
                'description': 'desc',
                'timestamp': ('pubdate', {int_or_none}),
                'view_count': (('viewCount', ('stat', 'view')), {int_or_none}),
                'comment_count': ('stat', 'reply', {int_or_none}),
            }, get_all=False),
            'id': f'{video_id}{format_field(part_id, None, "_p%d")}',
            '_old_archive_ids': [make_archive_id(self, old_video_id)] if old_video_id else None,
            'title': title,
            'http_headers': {'Referer': url},
        }

        is_interactive = traverse_obj(video_data, ('rights', 'is_stein_gate'))
        if is_interactive:
            return self.playlist_result(
                self._get_interactive_entries(video_id, cid, metainfo, headers=headers), **metainfo,
                duration=traverse_obj(initial_state, ('videoData', 'duration', {int_or_none})),
                __post_extractor=self.extract_comments(aid))

        play_info = self._download_playinfo(video_id, cid, headers=headers, query={'try_look': 1})
        formats = self.extract_formats(play_info)

        if video_data.get('is_upower_exclusive'):
            high_level = traverse_obj(initial_state, ('elecFullInfo', 'show_info', 'high_level', {dict})) or {}
            msg = f'{join_nonempty("title", "sub_title", from_dict=high_level, delim="，")}. {self._login_hint()}'
            if not formats:
                raise ExtractorError(f'This is a supporter-only video: {msg}', expected=True)
            if '试看' in traverse_obj(play_info, ('accept_description', ..., {str})):
                self.report_warning(
                    f'This is a supporter-only video, only the preview will be extracted: {msg}',
                    video_id=video_id)

        if not traverse_obj(play_info, 'dash'):
            # we only have legacy formats and need additional work
            has_qn = lambda x: x in traverse_obj(formats, (..., 'quality'))
            for qn in traverse_obj(play_info, ('accept_quality', lambda _, v: not has_qn(v), {int})):
                formats.extend(traverse_obj(
                    self.extract_formats(self._download_playinfo(video_id, cid, headers=headers, query={'qn': qn})),
                    lambda _, v: not has_qn(v['quality'])))
            self._check_missing_formats(play_info, formats)
            flv_formats = traverse_obj(formats, lambda _, v: v['fragments'])
            if flv_formats and len(flv_formats) < len(formats):
                # Flv and mp4 are incompatible due to `multi_video` workaround, so drop one
                if not self._configuration_arg('prefer_multi_flv'):
                    dropped_fmts = ', '.join(

Review comment (suggestion):
per https://github.com/yt-dlp/yt-dlp/pull/11734#issuecomment-2518613153, should we do this?
```suggestion
        play_info = None
        if self.is_logged_in:
            play_info = traverse_obj(
                self._search_json(r'window\.__playinfo__\s*=', webpage, 'play info', video_id, default=None),
                ('data', {dict}))
        if not play_info:
            play_info = self._download_playinfo(video_id, cid, headers=headers, query={'try_look': 1})
```

Code after:
                'uploader_id': ('upData', 'mid', {str_or_none}),
                'like_count': ('videoData', 'stat', 'like', {int_or_none}),
                'tags': ('tags', ..., 'tag_name'),
                'thumbnail': ('videoData', 'pic', {url_or_none}),
            }),
            **festival_info,
            **traverse_obj(video_data, {
                'description': 'desc',
                'timestamp': ('pubdate', {int_or_none}),
                'view_count': (('viewCount', ('stat', 'view')), {int_or_none}),
                'comment_count': ('stat', 'reply', {int_or_none}),
            }, get_all=False),
            'id': f'{video_id}{format_field(part_id, None, "_p%d")}',
            '_old_archive_ids': [make_archive_id(self, old_video_id)] if old_video_id else None,
            'title': title,
            'http_headers': {'Referer': url},
        }

        is_interactive = traverse_obj(video_data, ('rights', 'is_stein_gate'))
        if is_interactive:
            return self.playlist_result(
                self._get_interactive_entries(video_id, cid, metainfo, headers=headers), **metainfo,
                duration=traverse_obj(initial_state, ('videoData', 'duration', {int_or_none})),
                __post_extractor=self.extract_comments(aid))

        play_info = None
        if self.is_logged_in:
            play_info = traverse_obj(
                self._search_json(r'window\.__playinfo__\s*=', webpage, 'play info', video_id, default=None),
                ('data', {dict}))
        if not play_info:
            play_info = self._download_playinfo(video_id, cid, headers=headers, query={'try_look': 1})
        formats = self.extract_formats(play_info)

        if video_data.get('is_upower_exclusive'):
            high_level = traverse_obj(initial_state, ('elecFullInfo', 'show_info', 'high_level', {dict})) or {}
            msg = f'{join_nonempty("title", "sub_title", from_dict=high_level, delim="，")}. {self._login_hint()}'
            if not formats:
                raise ExtractorError(f'This is a supporter-only video: {msg}', expected=True)
            if '试看' in traverse_obj(play_info, ('accept_description', ..., {str})):
                self.report_warning(
                    f'This is a supporter-only video, only the preview will be extracted: {msg}',
                    video_id=video_id)

        if not traverse_obj(play_info, 'dash'):
            # we only have legacy formats and need additional work
            has_qn = lambda x: x in traverse_obj(formats, (..., 'quality'))
            for qn in traverse_obj(play_info, ('accept_quality', lambda _, v: not has_qn(v), {int})):
                formats.extend(traverse_obj(
                    self.extract_formats(self._download_playinfo(video_id, cid, headers=headers, query={'qn': qn})),
                    lambda _, v: not has_qn(v['quality'])))