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

Code before:
                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'),
                        '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-sl_{strm}_{f.get("mediaType").lower()}_{f.get("bitrate")}',
                        'format_note': 'Sign language interpretation',
                        'preference': -3
                    })

        self._sort_formats(formats)

        if any('intermission.mp4' in x.get('url', '') for x in formats):

Review comment (suggestion):
```suggestion
            formats.extend({
                '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")}'
            } for f in media.get('mediaFiles') if traverse_obj(f, ('streams', strm)))
```

(don't need to do this if making everything non-fatal over-complicates the comprehension)

Code after:

        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],
                'ext': traverse_obj(f, 'mediaType', expected_type=str.lower),
                'width': f.get('width'),
                'height': f.get('height'),
                'tbr': f.get('bitrate'),
                'filesize': f.get('filesize'),
            }
            for strm in ('http', 'https')
            for f in media.get('mediaFiles') or []
            if traverse_obj(f, ('streams', strm))
        )

        if any('intermission.mp4' in x['url'] for x in formats):
            self.raise_geo_restricted(countries=self._GEO_COUNTRIES, metadata_available=True)