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

Code before:
            note='Downloading video info',
            errnote='Unable to download video info')
        video_meta = video_meta_response.get('content')
        vod_id = video_meta.get('videoId')
        in_key = video_meta.get('inKey')
        playback_xml = self._download_xml(
            f'https://apis.naver.com/neonplayer/vodplay/v1/playback/{vod_id}', video_id,
            query={
                'key': in_key,
                'env': 'real',
                'lc': 'en_US',
                'cpl': 'en_US',
            },
            note='Downloading video playback',
            errnote='Unable to download video playback')

        thumbnails = []
        i = 0
        for source in playback_xml.iterfind(
            './Period/SupplementalProperty/nvod:Thumbnails/nvod:ThumbnailSet/nvod:Thumbnail/nvod:Source',
            NS_MAP,
        ):
            thumbnails.append({'id': str(i), 'url': source.text.split('?')[0]})
            i += 1

        formats, subtitles = self._parse_mpd_formats_and_subtitles(playback_xml)

        return {
            'id': video_id,
            'title': video_meta.get('videoTitle'),
            'thumbnail': video_meta.get('thumbnailImageUrl'),
            'thumbnails': thumbnails,
            'timestamp': video_meta.get('publishDateAt'),
            'view_count': video_meta.get('readCount'),
            'duration': video_meta.get('duration'),
            'channel': traverse_obj(video_meta, ('channel', 'channelName')),
            'channel_id': traverse_obj(video_meta, ('channel', 'channelId')),
            'channel_is_verified': traverse_obj(video_meta, ('channel', 'verifiedMark')),
            'formats': formats,
            'subtitles': subtitles,
        }


Review comment (refactor):
Hmm, I don't think it's worth it to extract the preview thumbnails, since we already have the regular thumbnail. Any specific reason you implemented this?
```suggestion
        formats, subtitles = self._extract_mpd_formats_and_subtitles(
            f'https://apis.naver.com/neonplayer/vodplay/v1/playback/{video_meta["videoId"]}', video_id,
            query={
                'key': video_meta['inKey'],
                'env': 'real',
                'lc': 'en_US',
                'cpl': 'en_US',
            }, note='Downloading video playback', errnote='Unable to download video playback')
```

Code after:
                'concurrent_view_count': ('concurrentUserCount', {int_or_none}),
                'view_count': ('accumulateCount', {int_or_none}),
                'channel': ('channel', 'channelName', {str}),
                'channel_id': ('channel', 'channelId', {str}),
                'channel_is_verified': ('channel', 'verifiedMark', {bool}),
            }),
        }


class CHZZKVideoIE(InfoExtractor):
    IE_NAME = 'chzzk:video'
    _VALID_URL = r'https?://chzzk\.naver\.com/video/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://chzzk.naver.com/video/1754',
        'md5': 'b0c0c1bb888d913b93d702b1512c7f06',
        'info_dict': {
            'id': '1754',
            'ext': 'mp4',
            'title': '치지직 테스트 방송',
            'channel': '침착맨',
            'channel_id': 'bb382c2c0cc9fa7c86ab3b037fb5799c',
            'channel_is_verified': False,
            'thumbnail': r're:^https?://.*\.jpg$',
            'duration': 15577,
            'timestamp': 1702970505.417,
            'upload_date': '20231219',
            'view_count': int,
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        video_meta = self._download_json(
            f'https://api.chzzk.naver.com/service/v2/videos/{video_id}', video_id,
            note='Downloading video info', errnote='Unable to download video info')['content']
        formats, subtitles = self._extract_mpd_formats_and_subtitles(
            f'https://apis.naver.com/neonplayer/vodplay/v1/playback/{video_meta["videoId"]}', video_id,
            query={
                'key': video_meta['inKey'],
                'env': 'real',
                'lc': 'en_US',
                'cpl': 'en_US',
            }, note='Downloading video playback', errnote='Unable to download video playback')

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(video_meta, {
                'title': ('videoTitle', {str}),
                'thumbnail': ('thumbnailImageUrl', {url_or_none}),