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

Code before:
            'title': video.get('title'),
            'description': self._get_description(video_id) or video.get('description'),
            'thumbnail': video.get('poster'),
            'duration': float_or_none(video.get('duration')),
            'timestamp': unified_timestamp(video.get('currentSunrise')),
            'series': video.get('label'),
            'season': season,
            'season_number': season_number,
            'episode': episode,
            'episode_number': episode_number,
            'formats': formats,
            'subtitles': subtitles,
        }

    def _get_description(self, video_id):
        info = self._download_json(
            f'https://backend.servustv.com/wp-json/rbmh/v2/media_asset/aa_id/{video_id}?fieldset=page',
            video_id, fatal=False)

        short_description = unescapeHTML(traverse_obj(info, 'stv_short_description', expected_type=str))
        long_description = unescapeHTML(traverse_obj(info, 'stv_long_description', expected_type=str, default=''))
        long_description = long_description.replace('\n\n', '\n')

        if short_description and long_description:
            return f'{short_description}\n\n{long_description}'
        return long_description or short_description

    def _report_errors(self, video):
        playability_errors = traverse_obj(video, ('playabilityErrors', ...))
        if not playability_errors:
            raise ExtractorError('No videoUrl and no information about errors')

        elif 'FSK_BLOCKED' in playability_errors:
            details = traverse_obj(video, ('playabilityErrorDetails', 'FSK_BLOCKED'), expected_type=dict)
            message = format_field(''.join([
                format_field(details, 'minEveningHour', ' from %02d:00'),
                format_field(details, 'maxMorningHour', ' to %02d:00'),
                format_field(details, 'minAge', ' (Minimum age %d)'),
            ]), None, 'Only available%s') or 'Blocked by FSK with unknown availability'

        elif 'NOT_YET_AVAILABLE' in playability_errors:
            message = format_field(
                video, (('playabilityErrorDetails', 'NOT_YET_AVAILABLE', 'availableFrom'), 'currentSunrise'),
                'Only available from %s') or 'Video not yet available with unknown availability'

        else:
            message = f'Video unavailable: {", ".join(playability_errors)}'

        raise ExtractorError(message, expected=True)


Review comment (security):
```suggestion
       return join_nonempty(*traverse_obj(info, (
           ('stv_short_description', 'stv_long_description'),
           {lambda x: unescapeHTML(x.replace('\n\n', '\n'))})), delim='\n\n')
```

Code after:
            'id': video_id,
            'title': video.get('title'),
            'description': self._get_description(video_id) or video.get('description'),
            'thumbnail': video.get('poster'),
            'duration': float_or_none(video.get('duration')),
            'timestamp': unified_timestamp(video.get('currentSunrise')),
            'series': video.get('label'),
            'season': season,
            'season_number': season_number,
            'episode': episode,
            'episode_number': episode_number,
            'formats': formats,
            'subtitles': subtitles,
        }

    def _get_description(self, video_id):
        info = self._download_json(
            f'https://backend.servustv.com/wp-json/rbmh/v2/media_asset/aa_id/{video_id}?fieldset=page',
            video_id, fatal=False)

        return join_nonempty(*traverse_obj(info, (
            ('stv_short_description', 'stv_long_description'),
            {lambda x: unescapeHTML(x.replace('\n\n', '\n'))})), delim='\n\n')

    def _report_errors(self, video):
        playability_errors = traverse_obj(video, ('playabilityErrors', ...))
        if not playability_errors:
            raise ExtractorError('No videoUrl and no information about errors')

        elif 'FSK_BLOCKED' in playability_errors:
            details = traverse_obj(video, ('playabilityErrorDetails', 'FSK_BLOCKED'), expected_type=dict)
            message = format_field(''.join((
                format_field(details, 'minEveningHour', ' from %02d:00'),
                format_field(details, 'maxMorningHour', ' to %02d:00'),
                format_field(details, 'minAge', ' (Minimum age %d)'),
            )), None, 'Only available%s') or 'Blocked by FSK with unknown availability'

        elif 'NOT_YET_AVAILABLE' in playability_errors:
            message = format_field(
                video, (('playabilityErrorDetails', 'NOT_YET_AVAILABLE', 'availableFrom'), 'currentSunrise'),
                'Only available from %s') or 'Video not yet available with unknown availability'

        else:
            message = f'Video unavailable: {", ".join(playability_errors)}'

        raise ExtractorError(message, expected=True)