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

Code before:
                    track_obj.update({'format_note': track.get('transport')})
                    if transport == 'RTMP':
                        m_obj = re.search(r'^(?:rtmp://[^/]+/(?P<app>[^/]+))/(?P<playpath>.+)$', href)
                        if not m_obj:
                            continue
                        track_obj.update(
                            {
                                'app': m_obj.group('app'),
                                'play_path': m_obj.group('playpath'),
                                'rtmp_live': True,
                                'preference': -2,
                            }
                        )
                        extention = m_obj.group('playpath').split(':')
                        if len(extention) > 1:
                            track_obj.update({'ext': extention[0]})

                audio_info = track.get('audio')
                if audio_info is not None:
                    if 'bitrate' in audio_info:
                        track_obj.update({'abr': int_or_none(audio_info.get('bitrate'), 1000)})
                    if 'samplingrate' in audio_info:
                        track_obj.update({'asr': int_or_none(audio_info.get('samplingrate'))})
                    audio_encoder = audio_info.get('encoder', {})
                    if 'type' in audio_encoder:
                        track_obj.update({'acodec': audio_encoder.get('type')})

                video_info = track.get('video')
                if video_info is not None:
                    if 'resolution' in video_info:
                        track_obj.update({'resolution': video_info.get('resolution')})
                        resolution = parse_resolution(video_info.get('resolution'))
                        track_obj.update(resolution)
                    if 'framerate' in video_info:
                        track_obj.update({'fps': int_or_none(video_info.get('framerate'))})
                    if 'bitrate' in video_info:
                        track_obj.update({'vbr': int_or_none(video_info.get('bitrate'), 1000)})
                    video_encoder = video_info.get('encoder', {})
                    if 'type' in video_encoder:
                        track_obj.update({'vcodec': video_encoder.get('type')})

                formats.append(track_obj)

        self._sort_formats(formats)

        result_obj = {'formats': formats}

        result_obj.update({'id': video_id})

        title = video.get('title')
        if title is not None:

Review comment (suggestion):
```suggestion
                    track_obj.update({
                        'abr': int_or_none(audio_info.get('bitrate'), 1000),
                        'asr': int_or_none(audio_info.get('samplingrate')),
                        'acodec': traverse_obj(audio_info, ('encoder', 'type')),
                    })
```

`None` values are allowed here as well
Same applies to video below

Code after:
                track_obj = {
                    'url': href,
                    'ext': ext,
                    'format_note': track.get('transport'),
                    'resolution': traverse_obj(track, ('video', 'resolution')),
                    'fps': int_or_none(traverse_obj(track, ('video', 'framerate'))),
                    'vbr': int_or_none(traverse_obj(track, ('video', 'bitrate')), scale=1000),
                    'vcodec': traverse_obj(track, ('video', 'encoder', 'type')) if track.get('video') else 'none',
                    'abr': int_or_none(traverse_obj(track, ('audio', 'bitrate')), scale=1000),
                    'asr': int_or_none(traverse_obj(track, ('audio', 'samplingrate'))),
                    'acodec': traverse_obj(track, ('audio', 'encoder', 'type')) if track.get('audio') else 'none',
                }

                if transport == 'RTMP':
                    m_obj = re.search(r'(?:rtmp://[^/]+/(?P<app>[^/]+))/(?P<ext>.+):(?P<playpath>.+)', href)
                    if not m_obj:
                        continue
                    track_obj.update({
                        'app': m_obj.group('app'),
                        'ext': m_obj.group('ext'),
                        'play_path': m_obj.group('ext') + ':' + m_obj.group('playpath'),
                        'rtmp_live': True,
                        'preference': -2,
                    })
                formats.append(track_obj)

        self._sort_formats(formats)

        return {
            'id': video_id,
            'formats': formats,
            'title': video.get('title'),
            'series': video.get('seriestitle'),
            'season_id': video.get('series'),
            'creator': traverse_obj(video, ('creators', 'creator')),
            'timestamp': parse_iso8601(video.get('start')),
            'thumbnail': traverse_obj(video, ('attachments', 'attachment', ..., 'url'), get_all=False),
        }


class OpencastIE(OpencastBaseIE):
    _VALID_URL = r'''(?x)
                    https?://(?P<host>%s)/paella/ui/watch.html\?.*?
                    id=(?P<id>%s)
                    ''' % (OpencastBaseIE._INSTANCES_RE, OpencastBaseIE._UUID_RE)

    _API_BASE = 'https://%s/search/episode.json?id=%s'

    _TESTS = [
        {
            'url': 'https://oc-video1.ruhr-uni-bochum.de/paella/ui/watch.html?id=ed063cd5-72c8-46b5-a60a-569243edcea8',