Compare commits

...

5 Commits

Author SHA1 Message Date
hui1601
d95809d677
[ie/chzzk] Fix typo 2024-11-01 08:50:48 +09:00
Dong Heon Hee
cff77c1de7
[ie/chzzk] Fix typo
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2024-11-01 08:48:07 +09:00
Dong Heon Hee
fba7cedecb
[ie/chzzk] Remove unnecessary .get() and traverse_obj
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2024-11-01 08:45:57 +09:00
Dong Heon Hee
6ae93df7e2
[ie/chzzk] Format code
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2024-11-01 08:41:23 +09:00
Dong Heon Hee
d4510efbc7
[ie/chzzk] Move video_status block
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
2024-11-01 08:40:21 +09:00

View File

@ -146,34 +146,27 @@ 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']
video_status = video_meta.get('vodStatus')
video_live_date = video_meta.get('liveOpenDate')
if video_live_date:
live_status = 'was_live'
else:
live_status = 'not_live'
live_status = 'was_live' if video_meta.get('liveOpenDate') else 'not_live'
video_status = video_meta.get('vodStatus')
if video_status == 'UPLOAD': if video_status == 'UPLOAD':
playback = self._parse_json(video_meta.get('liveRewindPlaybackJson'), video_id) playback = self._parse_json(video_meta['liveRewindPlaybackJson'], video_id)
formats, subtitles = self._extract_m3u8_formats_and_subtitles( formats, subtitles = self._extract_m3u8_formats_and_subtitles(
traverse_obj(playback, ('media', 0, 'path')), video_id, 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': elif video_status == 'ABR_HLS':
formats, subtitles = self._extract_mpd_formats_and_subtitles( formats, subtitles = self._extract_mpd_formats_and_subtitles(
f'https://apis.naver.com/neonplayer/vodplay/v1/playback/{video_meta.get("videoId")}', video_id, f'https://apis.naver.com/neonplayer/vodplay/v1/playback/{video_meta["videoId"]}',
query={ video_id, query={
'key': video_meta['inKey'], 'key': video_meta['inKey'],
'env': 'real', 'env': 'real',
'lc': 'en_US', 'lc': 'en_US',
'cpl': 'en_US', 'cpl': 'en_US',
}, note='Downloading video playback', errnote='Unable to download video playback') })
else: else:
self.raise_no_formats(f'Unknown video status detected: "{video_status}"', self.raise_no_formats(
expected=True, video_id=video_id) f'Unknown video status detected: "{video_status}"', expected=True, video_id=video_id)
formats = [] formats, subtitles = [], {}
subtitles = {} live_status = 'post_live' if live_status == 'was_live' else None
if live_status == 'was_live':
live_status = 'post_live'
return { return {
'id': video_id, 'id': video_id,
'formats': formats, 'formats': formats,