]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/mixch.py
1 from __future__
import unicode_literals
3 from .common
import InfoExtractor
10 class MixchIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?mixch\.tv/u/(?P<id>\d+)'
15 'url': 'https://mixch.tv/u/16236849/live',
16 'skip': 'don\'t know if this live persists',
19 'title': '24配信シェア⭕️投票🙏💦',
20 'comment_count': 13145,
22 'timestamp': 1636189377,
23 'uploader': '🦥伊咲👶🏻#フレアワ',
24 'uploader_id': '16236849',
27 'url': 'https://mixch.tv/u/16137876/live',
28 'only_matching': True,
31 def _real_extract(self
, url
):
32 video_id
= self
._match
_id
(url
)
33 webpage
= self
._download
_webpage
(f
'https://mixch.tv/u/{video_id}/live', video_id
)
35 initial_js_state
= self
._parse
_json
(self
._search
_regex
(
36 r
'(?m)^\s*window\.__INITIAL_JS_STATE__\s*=\s*(\{.+?\});\s*$', webpage
, 'initial JS state'), video_id
)
37 if not initial_js_state
.get('liveInfo'):
38 raise ExtractorError('Livestream has ended.', 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
,
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')