mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-13 23:02:34 +00:00
[extractor/mixch] Support --wait-for-video
This commit is contained in:
parent
d61ef7f343
commit
9012d20b23
1 changed files with 6 additions and 4 deletions
|
@ -32,8 +32,10 @@ class MixchIE(InfoExtractor):
|
||||||
|
|
||||||
initial_js_state = self._parse_json(self._search_regex(
|
initial_js_state = self._parse_json(self._search_regex(
|
||||||
r'(?m)^\s*window\.__INITIAL_JS_STATE__\s*=\s*(\{.+?\});\s*$', webpage, 'initial JS state'), video_id)
|
r'(?m)^\s*window\.__INITIAL_JS_STATE__\s*=\s*(\{.+?\});\s*$', webpage, 'initial JS state'), video_id)
|
||||||
if not initial_js_state.get('liveInfo'):
|
|
||||||
raise ExtractorError('Livestream has ended.', expected=True)
|
is_live = initial_js_state.get('liveInfo')
|
||||||
|
if not is_live:
|
||||||
|
self.raise_no_formats('Livestream has ended or has not started', expected=True)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
@ -48,8 +50,8 @@ class MixchIE(InfoExtractor):
|
||||||
'url': traverse_obj(initial_js_state, ('liveInfo', 'hls')) or 'https://d1hd0ww6piyb43.cloudfront.net/hls/torte_%s.m3u8' % video_id,
|
'url': traverse_obj(initial_js_state, ('liveInfo', 'hls')) or 'https://d1hd0ww6piyb43.cloudfront.net/hls/torte_%s.m3u8' % video_id,
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
}],
|
}] if is_live else [],
|
||||||
'is_live': True,
|
'live_status': 'is_live' if is_live else 'is_upcoming',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue