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

Code before:
                'upload_date': '20220201',
                'bitrate': 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).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")}'
                    })


Review comment (suggestion):
```suggestion
            lang = SUB_LANGS_MAP.get(s.get('language'), s.get('language') or 'und'))
            subs.setdefault(lang, []).append({'url': s.get('file'), 'format': s.get('format').lower()})
```

Code after:
            'info_dict': {
                'id': '174844609',
                'ext': 'mp3',
                'series_id': '106615841',
                'title': 'Il giornale della sera',
                'duration': 1328,
                'series': 'Il giornale della sera',
                'timestamp': 1643743800,
                'release_timestamp': 1643745424,
                'thumbnail': 'https://img.rtvcdn.si/_up/ava/ava_misc/show_logos/il-giornale-della-sera_wide2.jpg',
                'upload_date': '20220201',
                '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({