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

Code before:
            elif code in ('CONTENT_AVAILABLE_ONLY_FOR_BE_RESIDENTS_AND_EXPATS', 'CONTENT_IS_AGE_RESTRICTED', 'CONTENT_REQUIRES_AUTHENTICATION'):
                self.raise_login_required()
            else:
                raise ExtractorError(f'Unable to extract formats: {code}')

        return {
            **self._json_ld(
                traverse_obj(metadata, ('ldjson', ..., {json.loads})),
                video_id,
                fatal=False,
            ),
            **traverse_obj(metadata, ('episode', {
                'age_limit': ('ageRaw', {parse_age_limit}),
                'description': ('description', {str}),
                'duration': ('durationRaw', {parse_duration}),
                'episode': ('title', {str}),
                'episode_id': ('id', {str_or_none}),
                'episode_number': ('episodeNumberRaw', {int_or_none}),
                'season': ('season', 'titleRaw', {str}),
                'season_id': ('id', {str_or_none}),
                'season_number': ('season', 'titleRaw', {int_or_none}),
                'series': ('program', 'title', {str}),
                'timestamp': ('onTimeRaw', {parse_iso8601}),
                'title': ('title', {str}),
            })),
            'channel': 'VRT',
            'display_id': display_id,
            'duration': float_or_none(streaming_info.get('duration'), 1000),
            'formats': formats,
            'id': video_id,
            'subtitles': subtitles,
            'thumbnail': url_or_none(streaming_info.get('posterImageUrl')),
            '_old_archive_ids': [make_archive_id('Canvas', video_id)],
        }


class KetnetIE(VRTBaseIE):
    _VALID_URL = r'https?://(?:www\.)?ketnet\.be/(?P<id>(?:[^/]+/)*[^/?#&]+)'
    _TESTS = [{
        'url': 'https://www.ketnet.be/kijken/m/meisjes/6/meisjes-s6a5',
        'info_dict': {
            'id': 'pbs-pub-39f8351c-a0a0-43e6-8394-205d597d6162$vid-5e306921-a9aa-4fa9-9f39-5b82c8f1028e',
            'ext': 'mp4',
            'title': 'Meisjes',
            'episode': 'Reeks 6: Week 5',
            'season': 'Reeks 6',
            'series': 'Meisjes',
            'timestamp': 1685251800,
            'upload_date': '20230528',
        },
        'params': {'skip_download': 'm3u8'},

Review comment (suggestion):
In my previous version, `channel` was taken from `episode`'s `brand` instead of hard-coded `'VRT'`.
Should we use `brand` instead?
This will make sure that the actual TV channel is used instead of the generic `'VRT'`, which is actually the company name instead of the actual TV channel
```py
**traverse_obj(metadata, {
    'channel': ('episode', 'brand'),
})
```

Code after:
            **traverse_obj(metadata, ('episode', {
                'title': ('title', {str}),
                'description': ('description', {str}),
                'timestamp': ('onTimeRaw', {parse_iso8601}),
                'series': ('program', 'title', {str}),
                'season': ('season', 'titleRaw', {str}),
                'season_number': ('season', 'titleRaw', {int_or_none}),
                'season_id': ('id', {str_or_none}),
                'episode': ('title', {str}),
                'episode_number': ('episodeNumberRaw', {int_or_none}),
                'episode_id': ('id', {str_or_none}),
                'age_limit': ('ageRaw', {parse_age_limit}),
                'channel': ('brand', {str}),
                'duration': ('durationRaw', {parse_duration}),
            })),
            'id': video_id,
            'display_id': display_id,
            'formats': formats,
            'subtitles': subtitles,
            '_old_archive_ids': [make_archive_id('Canvas', video_id)],
        }


class KetnetIE(VRTBaseIE):
    _VALID_URL = r'https?://(?:www\.)?ketnet\.be/(?P<id>(?:[^/]+/)*[^/?#&]+)'
    _TESTS = [{
        'url': 'https://www.ketnet.be/kijken/m/meisjes/6/meisjes-s6a5',
        'info_dict': {
            'id': 'pbs-pub-39f8351c-a0a0-43e6-8394-205d597d6162$vid-5e306921-a9aa-4fa9-9f39-5b82c8f1028e',
            'ext': 'mp4',
            'title': 'Meisjes',
            'episode': 'Reeks 6: Week 5',
            'season': 'Reeks 6',
            'series': 'Meisjes',
            'timestamp': 1685251800,
            'upload_date': '20230528',
        },
        'params': {'skip_download': 'm3u8'},
    }]

    def _real_extract(self, url):
        display_id = self._match_id(url)

        video = self._download_json(
            'https://senior-bff.ketnet.be/graphql', display_id, query={
                'query': '''{
  video(id: "content/ketnet/nl/%s.model.json") {
    description
    episodeNr
    imageUrl
    mediaReference