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

Code before:
            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):
            self.raise_geo_restricted(countries=self._GEO_COUNTRIES, metadata_available=True)
        if any('dummy_720p.mp4' in x.get('manifest_url', '') for x in formats) and meta.get('stub', '') == 'error':
            raise ExtractorError(f'{self.IE_NAME} said: Clip not available')

        info = {
            'thumbnails': thumbs,
            'subtitles': subs,
            'title': meta.get('title'),
            'id': v_id,
            'description': meta.get('description'),
            'formats': formats,
            'timestamp': date,
            'release_timestamp': unified_timestamp(meta.get('recordingDate')),
            'duration': meta.get('duration') or parse_duration(meta.get('length')),
            'webpage_url': ''.join(traverse_obj(meta, ('canonical', ('domain', 'path')))),
            'tags': meta.get('genre'),
            'series': meta.get('showName'),
            'series_id': meta.get('showId'),
        }

        return info


Review comment (refactor):
```suggestion
            raise ExtractorError(f'{self.IE_NAME} said: Clip not available', expected=True)
```

Code after:
                    '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)
        if any('dummy_720p.mp4' in x.get('manifest_url', '') for x in formats) and meta.get('stub') == 'error':
            raise ExtractorError(f'{self.IE_NAME} said: Clip not available', expected=True)

        self._sort_formats(formats)
        return {
            'id': v_id,
            'webpage_url': ''.join(traverse_obj(meta, ('canonical', ('domain', 'path')))),
            'title': meta.get('title'),
            'formats': formats,
            'subtitles': subs,
            'thumbnails': thumbs,
            'description': meta.get('description'),
            'timestamp': unified_timestamp(traverse_obj(meta, 'broadcastDate', ('broadcastDates', 0))),
            'release_timestamp': unified_timestamp(meta.get('recordingDate')),
            'duration': meta.get('duration') or parse_duration(meta.get('length')),
            'tags': meta.get('genre'),
            'series': meta.get('showName'),
            'series_id': meta.get('showId'),
        }