]> jfr.im git - yt-dlp.git/commitdiff
[extractor/mixch] Support `--wait-for-video`
authorpukkandan <redacted>
Mon, 26 Dec 2022 21:31:08 +0000 (03:01 +0530)
committerpukkandan <redacted>
Mon, 26 Dec 2022 21:31:22 +0000 (03:01 +0530)
yt_dlp/extractor/mixch.py

index 3f430a71764c585ae7690220f3074e85f6b435b5..7eedbc7520096603b62aafbd7d00d1084020245a 100644 (file)
@@ -32,8 +32,10 @@ def _real_extract(self, url):
 
         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)
-        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 {
             'id': video_id,
@@ -48,8 +50,8 @@ def _real_extract(self, url):
                 'url': traverse_obj(initial_js_state, ('liveInfo', 'hls')) or 'https://d1hd0ww6piyb43.cloudfront.net/hls/torte_%s.m3u8' % video_id,
                 'ext': 'mp4',
                 'protocol': 'm3u8',
-            }],
-            'is_live': True,
+            }] if is_live else [],
+            'live_status': 'is_live' if is_live else 'is_upcoming',
         }