[ie/chzzk:video] Fix extraction (#11228)

Closes #11226
Authored by: hui1601
This commit is contained in:
Dong Heon Hee 2024-11-04 08:08:41 +09:00 committed by GitHub
parent a403dcf9be
commit 9c6534da81
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -146,19 +146,33 @@ class CHZZKVideoIE(InfoExtractor):
video_meta = self._download_json( video_meta = self._download_json(
f'https://api.chzzk.naver.com/service/v3/videos/{video_id}', video_id, f'https://api.chzzk.naver.com/service/v3/videos/{video_id}', video_id,
note='Downloading video info', errnote='Unable to download video info')['content'] 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, live_status = 'was_live' if video_meta.get('liveOpenDate') else 'not_live'
query={ video_status = video_meta.get('vodStatus')
'key': video_meta['inKey'], if video_status == 'UPLOAD':
'env': 'real', playback = self._parse_json(video_meta['liveRewindPlaybackJson'], video_id)
'lc': 'en_US', formats, subtitles = self._extract_m3u8_formats_and_subtitles(
'cpl': 'en_US', playback['media'][0]['path'], video_id, 'mp4', m3u8_id='hls')
}, note='Downloading video playback', errnote='Unable to download video playback') elif video_status == 'ABR_HLS':
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',
})
else:
self.raise_no_formats(
f'Unknown video status detected: "{video_status}"', expected=True, video_id=video_id)
formats, subtitles = [], {}
live_status = 'post_live' if live_status == 'was_live' else None
return { return {
'id': video_id, 'id': video_id,
'formats': formats, 'formats': formats,
'subtitles': subtitles, 'subtitles': subtitles,
'live_status': live_status,
**traverse_obj(video_meta, { **traverse_obj(video_meta, {
'title': ('videoTitle', {str}), 'title': ('videoTitle', {str}),
'thumbnail': ('thumbnailImageUrl', {url_or_none}), 'thumbnail': ('thumbnailImageUrl', {url_or_none}),