]>
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
)
36 is_live
= initial_js_state
.get('liveInfo')
38 self
.raise_no_formats('Livestream has ended or has not started', expected
=True)
42 'title': traverse_obj(initial_js_state
, ('liveInfo', 'title')),
43 'comment_count': traverse_obj(initial_js_state
, ('liveInfo', 'comments')),
44 'view_count': traverse_obj(initial_js_state
, ('liveInfo', 'visitor')),
45 'timestamp': traverse_obj(initial_js_state
, ('liveInfo', 'created')),
46 'uploader': traverse_obj(initial_js_state
, ('broadcasterInfo', 'name')),
47 'uploader_id': video_id
,
50 'url': traverse_obj(initial_js_state
, ('liveInfo', 'hls')) or 'https://d1hd0ww6piyb43.cloudfront.net/hls/torte_%s.m3u8' % video_id
,
53 }] if is_live
else [],
54 'live_status': 'is_live' if is_live
else 'is_upcoming',
58 class MixchArchiveIE(InfoExtractor
):
59 IE_NAME
= 'mixch:archive'
60 _VALID_URL
= r
'https?://(?:www\.)?mixch\.tv/archive/(?P<id>\d+)'
63 'url': 'https://mixch.tv/archive/421',
64 'skip': 'paid video, no DRM. expires at Jan 23',
67 'title': '96NEKO SHOW TIME',
71 def _real_extract(self
, url
):
72 video_id
= self
._match
_id
(url
)
73 webpage
= self
._download
_webpage
(url
, video_id
)
75 html5_videos
= self
._parse
_html
5_media
_entries
(
76 url
, webpage
.replace('video-js', 'video'), video_id
, 'hls')
78 self
.raise_login_required(method
='cookies')
79 infodict
= html5_videos
[0]
82 'title': self
._html
_search
_regex
(r
'class="archive-title">(.+?)</', webpage
, 'title')