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

Code before:
            'categories': ['mládež'],
            'series': 'Mistrovství Evropy do 20 let',
            'season': '2024-2025',
            'timestamp': 1725627600,
            'upload_date': '20240906',

        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        json_data = self._call_api(f'match/{video_id}', video_id)
        formats = []
        tbr_resolution_mapping = {'6000': '1080p', '2400': '720p', '1500': '480p', '800': '360p'}
        for video in traverse_obj(json_data, ('videos', 0, 'qualities')):
            formats.append({
                'url': video['cloud_front_path'],
                'tbr': int(video['quality']),
                'format_id': str(video['id']),
                'format_note': tbr_resolution_mapping[video['quality']],
            })
        data = {
            'id': video_id,
            **traverse_obj(json_data, {
                'series': ('competition_name', {str_or_none}),
                'season': ('season', {str_or_none}),
                'timestamp': ('match_time', {unified_timestamp}),
                'categories': ('category', ('title'), {str}, filter, all, filter),
                'thumbnail': ('poster', {url_or_none}),
            }),
            'formats': formats,
        }
        teams = list(set(traverse_obj(json_data, ('teams', ..., 'shortcut'))))
        if len(teams) > 2 and 'FIN' in teams:
            teams.remove('FIN')
        title = '-'.join(sorted(teams))
        if data.get('timestamp'):
            title += f" ({strftime_or_none(data['timestamp'], '%Y-%m-%d')})"
        data['title'] = title
        return data


class VolejTVClubPlaylistIE(VolejTVBaseIE):
    IE_NAME = 'volejtv:club'
    _VALID_URL = r'https?://volej\.tv/klub/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://volej.tv/klub/1173',
        'info_dict': {
            'id': '1173',
            'title': 'VK Jihostroj České Budějovice',
        },

Review comment (suggestion):
`{str}` should suffice, yeah?
```suggestion
                'series': ('competition_name', {str}),
                'season': ('season', {str}),
```

Code after:
            'series': 'ZLATÁ EVROPSKÁ VOLEJBALOVÁ LIGA',
            'season': '2023-2024',
            'timestamp': 1718553600,
            'upload_date': '20240616',
        },
    }, {
        'url': 'https://volej.tv/match/487520',
        'info_dict': {
            'id': '487520',
            'ext': 'mp4',
            'thumbnail': r're:https://.+\.(png|jpeg)',
            'title': 'FRA-CZE (2024-09-06)',
            'categories': ['mládež'],
            'series': 'Mistrovství Evropy do 20 let',
            'season': '2024-2025',
            'timestamp': 1725627600,
            'upload_date': '20240906',

        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        json_data = self._call_api(f'match/{video_id}', video_id)

        formats = []
        for video in traverse_obj(json_data, ('videos', 0, 'qualities', lambda _, v: url_or_none(v['cloud_front_path']))):
            formats.append(traverse_obj(video, {
                'url': 'cloud_front_path',
                'tbr': ('quality', {int_or_none}),
                'format_id': ('id', {str_or_none}),
                'height': ('quality', {self.TBR_HEIGHT_MAPPING.get}),
            }))

        data = {
            'id': video_id,
            **traverse_obj(json_data, {
                'series': ('competition_name', {str}),
                'season': ('season', {str}),
                'timestamp': ('match_time', {unified_timestamp}),
                'categories': ('category', ('title'), {str}, filter, all, filter),
                'thumbnail': ('poster', {url_or_none}),
            }),
            'formats': formats,
        }

        teams = orderedSet(traverse_obj(json_data, ('teams', ..., 'shortcut', {str})))
        if len(teams) > 2 and 'FIN' in teams:
            teams.remove('FIN')

        data['title'] = join_nonempty(