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

Code before:
                    'acodec': aud.get('codecs'),
                    'vcodec': 'none',
                    'filesize': aud.get('size'),
                })
        sub_json = self._call_api(f'/m/subtitle?ep_id={ep_id}&platform=web', ep_id)
        subtitles = {}
        for sub in sub_json.get('subtitles', []):
            sub_url = sub.get('url')
            if not sub_url:
                continue
            subtitles.setdefault(sub.get('key', 'en'), []).append({
                'url': sub_url,
            })
        self._sort_formats(formats)
        return formats, subtitles

    def _extract_ep_info(self, episode_data, ep_id):
        formats, subtitles = self._extract_formats_and_subtitles(ep_id)
        return {
            'id': ep_id,
            'title': episode_data['long_title'] or episode_data.get('title'),
            'thumbnail': episode_data.get('cover'),
            'episode_number': str_to_int(episode_data.get('title')),
            'formats': formats,
            'subtitles': subtitles,
        }


class BiliIntlIE(BiliIntlBaseIE):
    _VALID_URL = r'https?://(?:www\.)?bili(?P<type>bili\.tv|intl.com)/(?:[a-z]{2}/)?play/(?P<season_id>\d+)/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://www.bilibili.tv/en/play/34613/341736',
        'info_dict': {
            'id': '341736',
            'ext': 'mp4',
            'title': 'The First Night',
            'thumbnail': 'https://i0.hdslb.com/bfs/intl/management/91e30e5521235d9b163339a26a0b030ebda54310.png',
            'episode_number': 2,
        },
        'params': {
            'format': 'bv',
        },
    }, {
        'url': 'https://www.biliintl.com/en/play/34613/341736',
        'info_dict': {
            'id': '341736',
            'ext': 'mp4',
            'title': 'The First Night',
            'thumbnail': 'https://i0.hdslb.com/bfs/intl/management/91e30e5521235d9b163339a26a0b030ebda54310.png',
            'episode_number': 2,
        },

Review comment (refactor):
```suggestion
        return {
            'id': ep_id,
            'extractor_key': BiliIntlIE.ie_key(),
            'title': episode_data['long_title'] or episode_data.get('title'),
            'thumbnail': episode_data.get('cover'),
            'episode_number': str_to_int(episode_data.get('title')),
            'formats': formats,
            'subtitles': subtitles,
        }
```

This ensures that the archive stays consistent

Code after:
                'width': video_res.get('width'),
                'height': video_res.get('height'),
                'vbr': video_res.get('bandwidth'),
                'acodec': 'none',
                'vcodec': video_res.get('codecs'),
                'filesize': video_res.get('size'),
            })
        for aud in video_json.get('audio_resource', []):
            if not aud.get('url'):
                continue
            formats.append({
                'url': aud['url'],
                'ext': 'mp4',
                'abr': aud.get('bandwidth'),
                'acodec': aud.get('codecs'),
                'vcodec': 'none',
                'filesize': aud.get('size'),
            })

        self._sort_formats(formats)
        return formats

    def _extract_ep_info(self, type, episode_data, ep_id):
        return {
            'id': ep_id,
            'title': episode_data.get('long_title') or episode_data['title'],
            'thumbnail': episode_data.get('cover'),
            'episode_number': str_to_int(episode_data.get('title')),
            'formats': self._get_formats(type, ep_id),
            'subtitles': self._get_subtitles(type, ep_id),
            'extractor_key': BiliIntlIE.ie_key(),
        }


class BiliIntlIE(BiliIntlBaseIE):
    _VALID_URL = r'https?://(?:www\.)?bili(?P<type>bili\.tv|intl.com)/(?:[a-z]{2}/)?play/(?P<season_id>\d+)/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://www.bilibili.tv/en/play/34613/341736',
        'info_dict': {
            'id': '341736',
            'ext': 'mp4',
            'title': 'The First Night',
            'thumbnail': 'https://i0.hdslb.com/bfs/intl/management/91e30e5521235d9b163339a26a0b030ebda54310.png',
            'episode_number': 2,
        },
        'params': {
            'format': 'bv',
        },
    }, {
        'url': 'https://www.biliintl.com/en/play/34613/341736',
        'info_dict': {