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

Code before:
            errnote='Unable to download channel info')
        live_detail = live_detail_response.get('content')

        if live_detail.get('status') == 'CLOSE':
            raise ExtractorError('The channel is not currently live', expected=True)

        live_playback = self._parse_json(live_detail.get('livePlaybackJson'), channel_id)

        thumbnails = []
        thumbnail_template = traverse_obj(live_playback, ('thumbnail', 'snapshotThumbnailTemplate'))
        for width in traverse_obj(live_playback, ('thumbnail', 'types')):
            thumbnails.append({
                'id': width,
                'url': thumbnail_template.replace('{type}', width),
                'width': int(width),
            })

        formats, subtitles = [], {}
        for media in live_playback.get('media'):
            media_url = media.get('path')
            fmts, subs = self._extract_m3u8_formats_and_subtitles(media_url, channel_id, 'mp4')
            if media.get('mediaId') == 'LLHLS':
                for fmt in fmts:
                    fmt['format_id'] += '-ll'
            formats.extend(fmts)
            self._merge_subtitles(subtitles, subs)

        return {
            'id': str(channel_id),
            'title': live_detail.get('liveTitle'),
            'thumbnails': thumbnails,
            'timestamp': parse_iso8601(live_detail.get('openDate')),
            'view_count': live_detail.get('concurrentUserCount'),
            'channel': traverse_obj(live_detail, ('channel', 'channelName')),
            'channel_id': traverse_obj(live_detail, ('channel', 'channelId')),
            'channel_is_verified': traverse_obj(live_detail, ('channel', 'verifiedMark')),
            'is_live': True,
            'formats': formats,
            'subtitles': subtitles,
        }


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',
        'only_matching': True,
    }]

    def _real_extract(self, url):

Review comment (suggestion):
Need to actually be saved
```suggestion
            self._merge_subtitles(subs, target=subtitles)
```

Code after:
            'title': str,
            'channel': '진짜도현',
            'channel_id': 'c68b8ef525fb3d2fa146344d84991753',
            'channel_is_verified': False,
            'thumbnail': r're:^https?://.*\.jpg$',
            'timestamp': 1705510344,
            'upload_date': '20240117',
            'live_status': 'is_live',
            'view_count': int,
            'concurrent_view_count': int,
        },
        'skip': 'The channel is not currently live',
    }]

    def _real_extract(self, url):
        channel_id = self._match_id(url)
        live_detail = self._download_json(
            f'https://api.chzzk.naver.com/service/v2/channels/{channel_id}/live-detail', channel_id,
            note='Downloading channel info', errnote='Unable to download channel info')['content']

        if live_detail.get('status') == 'CLOSE':
            raise ExtractorError('The channel is not currently live', expected=True)

        live_playback = self._parse_json(live_detail['livePlaybackJson'], channel_id)

        thumbnails = []
        thumbnail_template = traverse_obj(
            live_playback, ('thumbnail', 'snapshotThumbnailTemplate', {url_or_none}))
        if thumbnail_template and '{type}' in thumbnail_template:
            for width in traverse_obj(live_playback, ('thumbnail', 'types', ..., {str})):
                thumbnails.append({
                    'id': width,
                    'url': thumbnail_template.replace('{type}', width),
                    'width': int_or_none(width),
                })

        formats, subtitles = [], {}
        for media in traverse_obj(live_playback, ('media', lambda _, v: url_or_none(v['path']))):
            is_low_latency = media.get('mediaId') == 'LLHLS'
            fmts, subs = self._extract_m3u8_formats_and_subtitles(
                media['path'], channel_id, 'mp4', fatal=False, live=True,
                m3u8_id='hls-ll' if is_low_latency else 'hls')
            for f in fmts:
                if is_low_latency:
                    f['source_preference'] = -2
                if '-afragalow.stream-audio.stream' in f['format_id']:
                    f['quality'] = -2
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)

        return {