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

Code before:
    }]

    def _real_extract(self, url):
        content_code, channel_id = self._match_valid_url(url).group('code', 'channel')
        fanclub_site_id = self._find_fanclub_site_id(channel_id)

        data_json = self._call_api(
            f'video_pages/{content_code}', item_id=content_code, headers={'fc_use_device': 'null'},
            note='Fetching video page info', errnote='Unable to fetch video page info',
        )['data']['video_page']

        live_status, session_id = self._get_live_status_and_session_id(content_code, data_json)

        release_timestamp_str = data_json.get('live_scheduled_start_at')

        formats = []

        if live_status == 'is_upcoming':
            if release_timestamp_str:
                self.raise_no_formats(
                    f'This live event will begin at {release_timestamp_str} UTC', expected=True,
                    video_id=content_code)
            else:
                # has not encountered this situation, but still give it a chance.
                self.raise_no_formats(
                    'This event has not started yet', expected=True, video_id=content_code)
        else:
            formats = self._extract_m3u8_formats(
                # "authenticated_url" is a format string contains "{session_id}".
                m3u8_url=data_json['video_stream']['authenticated_url'].format(session_id=session_id),
                video_id=content_code)

        return {
            # mandatory metafields

            'id': content_code,
            'title': data_json['title'],
            'formats': formats,

            # optional metafields

            '_format_sort_fields': ('tbr', 'vcodec', 'acodec'),

            'channel': self._get_channel_base_info(fanclub_site_id).get('fanclub_site_name'),
            'channel_id': channel_id,
            'channel_url': f'{self._WEBPAGE_BASE_URL}/{channel_id}',

            'age_limit': traverse_obj(self._get_channel_user_info(fanclub_site_id), ('content_provider', 'age_limit')),
            'live_status': live_status,

            'thumbnail': data_json.get('thumbnail_url'),

Review comment (suggestion):
```suggestion
        if live_status == 'is_upcoming':
            if release_timestamp_str:
                msg = f'This live event will begin at {release_timestamp_str} UTC'
            else:
                msg = 'This event has not started yet'
            self.raise_no_formats(msg, expected=True, video_id=content_code)
```

Code after:
            'skip_download': True,
        },
    }]

    def _real_extract(self, url):
        content_code, channel_id = self._match_valid_url(url).group('code', 'channel')
        fanclub_site_id = self._find_fanclub_site_id(channel_id)

        data_json = self._call_api(
            f'video_pages/{content_code}', item_id=content_code, headers={'fc_use_device': 'null'},
            note='Fetching video page info', errnote='Unable to fetch video page info',
        )['data']['video_page']

        live_status, session_id = self._get_live_status_and_session_id(content_code, data_json)

        release_timestamp_str = data_json.get('live_scheduled_start_at')

        formats = []

        if live_status == 'is_upcoming':
            if release_timestamp_str:
                msg = f'This live event will begin at {release_timestamp_str} UTC'
            else:
                msg = 'This event has not started yet'
            self.raise_no_formats(msg, expected=True, video_id=content_code)
        else:
            formats = self._extract_m3u8_formats(
                # "authenticated_url" is a format string that contains "{session_id}".
                m3u8_url=data_json['video_stream']['authenticated_url'].format(session_id=session_id),
                video_id=content_code)

        return {
            'id': content_code,
            'formats': formats,
            '_format_sort_fields': ('tbr', 'vcodec', 'acodec'),
            'channel': self._get_channel_base_info(fanclub_site_id).get('fanclub_site_name'),
            'channel_id': channel_id,
            'channel_url': f'{self._WEBPAGE_BASE_URL}/{channel_id}',
            'age_limit': traverse_obj(self._get_channel_user_info(fanclub_site_id), ('content_provider', 'age_limit')),
            'live_status': live_status,
            'release_timestamp': unified_timestamp(release_timestamp_str),
            **traverse_obj(data_json, {
                'title': ('title', {str}),
                'thumbnail': ('thumbnail_url', {url_or_none}),
                'description': ('description', {str}),
                'timestamp': ('released_at', {unified_timestamp}),
                'duration': ('active_video_filename', 'length', {int_or_none}),
                'comment_count': ('video_aggregate_info', 'number_of_comments', {int_or_none}),
                'view_count': ('video_aggregate_info', 'total_views', {int_or_none}),
                'tags': ('video_tags', ..., 'tag', {str}),
            }),