]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/mixch.py
1 from .common
import InfoExtractor
8 class MixchIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?mixch\.tv/u/(?P<id>\d+)'
13 'url': 'https://mixch.tv/u/16236849/live',
14 'skip': 'don\'t know if this live persists',
17 'title': '24配信シェア⭕️投票🙏💦',
18 'comment_count': 13145,
20 'timestamp': 1636189377,
21 'uploader': '🦥伊咲👶🏻#フレアワ',
22 'uploader_id': '16236849',
25 'url': 'https://mixch.tv/u/16137876/live',
26 'only_matching': True,
29 def _real_extract(self
, url
):
30 video_id
= self
._match
_id
(url
)
31 webpage
= self
._download
_webpage
(f
'https://mixch.tv/u/{video_id}/live', video_id
)
33 initial_js_state
= self
._parse
_json
(self
._search
_regex
(
34 r
'(?m)^\s*window\.__INITIAL_JS_STATE__\s*=\s*(\{.+?\});\s*$', webpage
, 'initial JS state'), video_id
)
35 if not initial_js_state
.get('liveInfo'):
36 raise ExtractorError('Livestream has ended.', expected
=True)
40 'title': traverse_obj(initial_js_state
, ('liveInfo', 'title')),
41 'comment_count': traverse_obj(initial_js_state
, ('liveInfo', 'comments')),
42 'view_count': traverse_obj(initial_js_state
, ('liveInfo', 'visitor')),
43 'timestamp': traverse_obj(initial_js_state
, ('liveInfo', 'created')),
44 'uploader': traverse_obj(initial_js_state
, ('broadcasterInfo', 'name')),
45 'uploader_id': video_id
,
48 'url': traverse_obj(initial_js_state
, ('liveInfo', 'hls')) or 'https://d1hd0ww6piyb43.cloudfront.net/hls/torte_%s.m3u8' % video_id
,
56 class MixchArchiveIE(InfoExtractor
):
57 IE_NAME
= 'mixch:archive'
58 _VALID_URL
= r
'https?://(?:www\.)?mixch\.tv/archive/(?P<id>\d+)'
61 'url': 'https://mixch.tv/archive/421',
62 'skip': 'paid video, no DRM. expires at Jan 23',
65 'title': '96NEKO SHOW TIME',
69 def _real_extract(self
, url
):
70 video_id
= self
._match
_id
(url
)
71 webpage
= self
._download
_webpage
(url
, video_id
)
73 html5_videos
= self
._parse
_html
5_media
_entries
(
74 url
, webpage
.replace('video-js', 'video'), video_id
, 'hls')
76 self
.raise_login_required(method
='cookies')
77 infodict
= html5_videos
[0]
80 'title': self
._html
_search
_regex
(r
'class="archive-title">(.+?)</', webpage
, 'title')