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

Code before:
            'tags': ['Paryż', 'Francja', 'Polska', 'Imigranci', 'Morawiecki', 'Tusk'],
            'like_count': int,
            'dislike_count': int,
            'view_count': int,
            'comment_count': int,
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        playlist_id = self._extract_playlist_id(url, 'playlistId')

        if self._yes_playlist(playlist_id, video_id):
            return self._extract_playlist(playlist_id)

        data = self._download_json(f'{self._API_BASE}/videos/{video_id}', video_id)
        thumbnails = [{
            'id': f'{quality}p',
            'url': f'{self._CDN_BASE}/video/{video_id}/{quality}.webp',
        } for quality in [48, 96, 144, 240, 512, 1080]]
        formats = []
        url_data = self._download_json(f'{self._API_BASE}/videos/{video_id}/url', video_id, data=b'')
        master_playlist_url = traverse_obj(url_data, ('src', 'hls', 'masterPlaylist'))

        if master_playlist_url:
            formats = self._extract_m3u8_formats(master_playlist_url, video_id, 'mp4', m3u8_id='hls', fatal=False)

        if not formats:
            for format_id, url in traverse_obj(url_data, (
                    'src', ('mp4', 'hls'), 'levels', {dict.items}, lambda _, v: url_or_none(v[1]))):
                if determine_ext(url) == 'm3u8':
                    fmts = self._extract_m3u8_formats(url, video_id, 'mp4', m3u8_id='hls', fatal=False)
                    for f in fmts:
                        f['height'] = int_or_none(format_id)
                    formats.extend(fmts)
                else:
                    formats.append({
                        'url': url,
                        'format_id': format_id,
                        'height': int_or_none(format_id),
                    })

        return {
            'id': video_id,
            'title': data.get('title'),
            'description': data.get('desc'),
            'uploader': traverse_obj(data, ('channel', 'name')),
            'channel_id': data.get('channelId'),
            'channel_url': format_field(data, 'channelId', 'https://banbye.com/channel/%s'),
            'timestamp': unified_timestamp(data.get('publishedAt')),
            'duration': data.get('duration'),

Review comment (refactor):
```suggestion
        if master_url := traverse_obj(url_data, ('src', 'hls', 'masterPlaylist', {url_or_none})):
            formats = self._extract_m3u8_formats(master_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
```

Code after:
            'timestamp': 1688642656,
            'upload_date': '20230706',
            'thumbnail': 'https://cdn.banbye.com/video/v_kb6_o1Kyq-CD/96.webp',
            'tags': ['Paryż', 'Francja', 'Polska', 'Imigranci', 'Morawiecki', 'Tusk'],
            'like_count': int,
            'dislike_count': int,
            'view_count': int,
            'comment_count': int,
        },
    }, {
        # ['src']['hls']['levels'] variant m3u8 urls only; master m3u8 is 404
        'url': 'https://banbye.com/watch/v_a_gPFuC9LoW5',
        'info_dict': {
            'id': 'v_a_gPFuC9LoW5',
            'ext': 'mp4',
            'title': 'md5:183524056bebdfa245fd6d214f63c0fe',
            'description': 'md5:943ac87287ca98d28d8b8797719827c6',
            'uploader': 'wRealu24',
            'channel_id': 'ch_wrealu24',
            'channel_url': 'https://banbye.com/channel/ch_wrealu24',
            'upload_date': '20231113',
            'timestamp': 1699874062,
            'view_count': int,
            'like_count': int,
            'dislike_count': int,
            'comment_count': int,
            'thumbnail': 'https://cdn.banbye.com/video/v_a_gPFuC9LoW5/96.webp',
            'tags': ['jaszczur', 'sejm', 'lewica', 'polska', 'ukrainizacja', 'pierwszeposiedzeniesejmu'],
        },
        'expected_warnings': ['Failed to download m3u8'],
    }, {
        # ['src']['hls']['masterPlaylist'] m3u8 only
        'url': 'https://banbye.com/watch/v_B0rsKWsr-aaa',
        'info_dict': {
            'id': 'v_B0rsKWsr-aaa',
            'ext': 'mp4',
            'title': 'md5:00b254164b82101b3f9e5326037447ed',
            'description': 'md5:3fd8b48aa81954ba024bc60f5de6e167',
            'uploader': 'PSTV Piotr Szlachtowicz ',
            'channel_id': 'ch_KV9EVObkB9wB',
            'channel_url': 'https://banbye.com/channel/ch_KV9EVObkB9wB',
            'upload_date': '20240629',
            'timestamp': 1719646816,
            'duration': 2377,
            'view_count': int,
            'like_count': int,
            'dislike_count': int,
            'comment_count': int,
            'thumbnail': 'https://cdn.banbye.com/video/v_B0rsKWsr-aaa/96.webp',
            'tags': ['Biden', 'Trump', 'Wybory', 'USA'],
        },