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

Code before:
            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):
        formats = self._get_formats(type, ep_id)
        subtitles = self._get_subtitles(type, 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,
            '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': {
            '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,
            '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.extract_subtitles(type, ep_id),
            'extractor_key': BiliIntlIE.ie_key(),
        }
```

Code after:
            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': {
            'id': '341736',
            'ext': 'mp4',
            'title': 'The First Night',
            'thumbnail': 'https://i0.hdslb.com/bfs/intl/management/91e30e5521235d9b163339a26a0b030ebda54310.png',
            'episode_number': 2,
        },
        'params': {
            'format': 'bv',