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

Code before:
    def _real_extract(self, url):
        v_id = self._match_id(url)
        meta = self._download_json(self._API_BASE.format('getRecordingDrm', v_id), v_id).get('response')
        date = unified_timestamp(meta.get('broadcastDate') or meta.get('broadcastDates')[0])

        thumbs = [{'id': k, 'url': v} for (k, v) in meta.get('images').items()]
        SUB_LANGS_MAP = {'Slovenski': 'sl', }

        subs = {}
        for s in traverse_obj(meta, 'subs', 'subtitles', default={}):
            if s.get('language') in SUB_LANGS_MAP.keys():
                s['language'] = SUB_LANGS_MAP[s['language']]
            if not subs.get(s.get('language'), False):
                subs[s.get('language')] = []
            subs[s.get('language')].append({'url': s.get('file'), 'format': s.get('format').lower()})

        jwt = meta.get('jwt')
        if not jwt:
            raise ExtractorError('Site did not provide an authentication token, cannot proceed.')

        media = self._download_json(self._API_BASE.format('getMedia', v_id) + f'&jwt={jwt}', v_id).get('response')

        formats = []
        if media.get('addaptiveMedia', False):
            formats = self._extract_wowza_formats(
                traverse_obj(media, ('addaptiveMedia', 'hls_sec'), expected_type=str),
                v_id, skip_protocols=['smil'])
        for strm in ('http', 'https'):
            for f in media.get('mediaFiles'):
                if traverse_obj(f, ('streams', strm)):
                    formats.append({
                        'bitrate': f.get('bitrate'),
                        'url': traverse_obj(f, ('streams', strm)),
                        'filesize': f.get('filesize'),
                        'width': f.get('width'),
                        'height': f.get('height'),
                        'ext': f.get('mediaType').lower(),
                        'format_id': f'files_{strm}_{f.get("mediaType").lower()}_{f.get("bitrate")}'
                    })

        if media.get('addaptiveMedia_sl', False):
            for f in self._extract_wowza_formats(
                traverse_obj(media, ('addaptiveMedia_sl', 'hls_sec')), v_id, skip_protocols=['smil']
            ):
                f.update({'format_note': 'Sign language interpretation', 'preference': -3})
                formats.append(f)
        for strm in ('http', 'https'):
            for f in media.get('mediaFiles_sl'):
                if traverse_obj(f, ('streams', strm)):
                    formats.append({
                        'bitrate': f.get('bitrate'),

Review comment (suggestion):
```suggestion
                traverse_obj(media, ('addaptiveMedia', 'hls_sec'), expected_type=url_or_none),
```

Code after:
                'tbr': 128000,
                'release_date': '20220201',
            },

        }, {
            'url': 'https://4d.rtvslo.si/arhiv/dnevnik/174842550',
            'only_matching': True
        }
    ]

    def _real_extract(self, url):
        v_id = self._match_id(url)
        meta = self._download_json(self._API_BASE.format('getRecordingDrm', v_id), v_id)['response']

        thumbs = [{'id': k, 'url': v, 'http_headers': {'Accept': 'image/jpeg'}}
                  for k, v in (meta.get('images') or {}).items()]

        subs = {}
        for s in traverse_obj(meta, 'subs', 'subtitles', default=[]):
            lang = self.SUB_LANGS_MAP.get(s.get('language'), s.get('language') or 'und')
            subs.setdefault(lang, []).append({
                'url': s.get('file'),
                'ext': traverse_obj(s, 'format', expected_type=str.lower),
            })

        jwt = meta.get('jwt')
        if not jwt:
            raise ExtractorError('Site did not provide an authentication token, cannot proceed.')

        media = self._download_json(self._API_BASE.format('getMedia', v_id), v_id, query={'jwt': jwt})['response']

        formats = []
        adaptive_url = traverse_obj(media, ('addaptiveMedia', 'hls_sec'), expected_type=url_or_none)
        if adaptive_url:
            formats = self._extract_wowza_formats(adaptive_url, v_id, skip_protocols=['smil'])

        adaptive_url = traverse_obj(media, ('addaptiveMedia_sl', 'hls_sec'), expected_type=url_or_none)
        if adaptive_url:
            for f in self._extract_wowza_formats(adaptive_url, v_id, skip_protocols=['smil']):
                formats.append({
                    **f,
                    'format_id': 'sign-' + f['format_id'],
                    'format_note': 'Sign language interpretation', 'preference': -10,
                    'language': (
                        'slv' if f.get('language') == 'eng' and f.get('acodec') != 'none'
                        else f.get('language'))
                })

        formats.extend(
            {
                'url': f['streams'][strm],