1 from .common
import InfoExtractor
2 from ..utils
import UserNotLive
, traverse_obj
5 class MixchIE(InfoExtractor
):
7 _VALID_URL
= r
'https?://(?:www\.)?mixch\.tv/u/(?P<id>\d+)'
10 'url': 'https://mixch.tv/u/16236849/live',
11 'skip': 'don\'t know if this live persists',
14 'title': '24配信シェア⭕️投票🙏💦',
15 'comment_count': 13145,
17 'timestamp': 1636189377,
18 'uploader': '🦥伊咲👶🏻#フレアワ',
19 'uploader_id': '16236849',
22 'url': 'https://mixch.tv/u/16137876/live',
23 'only_matching': True,
26 def _real_extract(self
, url
):
27 video_id
= self
._match
_id
(url
)
28 webpage
= self
._download
_webpage
(f
'https://mixch.tv/u/{video_id}/live', video_id
)
30 initial_js_state
= self
._parse
_json
(self
._search
_regex
(
31 r
'(?m)^\s*window\.__INITIAL_JS_STATE__\s*=\s*(\{.+?\});\s*$', webpage
, 'initial JS state'), video_id
)
32 if not initial_js_state
.get('liveInfo'):
33 raise UserNotLive(video_id
=video_id
)
37 'title': traverse_obj(initial_js_state
, ('liveInfo', 'title')),
38 'comment_count': traverse_obj(initial_js_state
, ('liveInfo', 'comments')),
39 'view_count': traverse_obj(initial_js_state
, ('liveInfo', 'visitor')),
40 'timestamp': traverse_obj(initial_js_state
, ('liveInfo', 'created')),
41 'uploader': traverse_obj(initial_js_state
, ('broadcasterInfo', 'name')),
42 'uploader_id': video_id
,
45 'url': (traverse_obj(initial_js_state
, ('liveInfo', 'hls'))
46 or f
'https://d1hd0ww6piyb43.cloudfront.net/hls/torte_{video_id}.m3u8'),
54 class MixchArchiveIE(InfoExtractor
):
55 IE_NAME
= 'mixch:archive'
56 _VALID_URL
= r
'https?://(?:www\.)?mixch\.tv/archive/(?P<id>\d+)'
59 'url': 'https://mixch.tv/archive/421',
60 'skip': 'paid video, no DRM. expires at Jan 23',
63 'title': '96NEKO SHOW TIME',
67 def _real_extract(self
, url
):
68 video_id
= self
._match
_id
(url
)
69 webpage
= self
._download
_webpage
(url
, video_id
)
71 html5_videos
= self
._parse
_html
5_media
_entries
(
72 url
, webpage
.replace('video-js', 'video'), video_id
, 'hls')
74 self
.raise_login_required(method
='cookies')
75 infodict
= html5_videos
[0]
78 'title': self
._html
_search
_regex
(r
'class="archive-title">(.+?)</', webpage
, 'title')