mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-13 20:53:06 +00:00
Fix 9012d20b23
This commit is contained in:
parent
9012d20b23
commit
4af47a0003
@ -1,8 +1,5 @@
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import UserNotLive, traverse_obj
|
||||||
ExtractorError,
|
|
||||||
traverse_obj,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class MixchIE(InfoExtractor):
|
class MixchIE(InfoExtractor):
|
||||||
@ -32,10 +29,8 @@ 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'):
|
||||||
is_live = initial_js_state.get('liveInfo')
|
raise UserNotLive(video_id=video_id)
|
||||||
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,
|
||||||
@ -47,11 +42,12 @@ class MixchIE(InfoExtractor):
|
|||||||
'uploader_id': video_id,
|
'uploader_id': video_id,
|
||||||
'formats': [{
|
'formats': [{
|
||||||
'format_id': 'hls',
|
'format_id': 'hls',
|
||||||
'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 f'https://d1hd0ww6piyb43.cloudfront.net/hls/torte_{video_id}.m3u8'),
|
||||||
'ext': 'mp4',
|
'ext': 'mp4',
|
||||||
'protocol': 'm3u8',
|
'protocol': 'm3u8',
|
||||||
}] if is_live else [],
|
}],
|
||||||
'live_status': 'is_live' if is_live else 'is_upcoming',
|
'is_live': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user