1 from .common
import InfoExtractor
2 from ..networking
.exceptions
import HTTPError
10 from ..utils
.traversal
import traverse_obj
13 class MixchIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://(?:www\.)?mixch\.tv/u/(?P<id>\d+)'
18 'url': 'https://mixch.tv/u/16943797/live',
19 'skip': 'don\'t know if this live persists',
23 'title': '#EntView #カリナ #セブチ 2024-05-05 06:58',
26 'timestamp': 1714726805,
27 'uploader': 'Ent.View K-news🎶💕',
28 'uploader_id': '16943797',
29 'live_status': 'is_live',
30 'upload_date': '20240503',
33 'url': 'https://mixch.tv/u/16137876/live',
34 'only_matching': True,
37 def _real_extract(self
, url
):
38 video_id
= self
._match
_id
(url
)
39 data
= self
._download
_json
(f
'https://mixch.tv/api-web/users/{video_id}/live', video_id
)
40 if not traverse_obj(data
, ('liveInfo', {dict}
)):
41 raise UserNotLive(video_id
=video_id
)
45 'uploader_id': video_id
,
46 **traverse_obj(data
, {
47 'title': ('liveInfo', 'title', {str}
),
48 'comment_count': ('liveInfo', 'comments', {int_or_none}
),
49 'view_count': ('liveInfo', 'visitor', {int_or_none}
),
50 'timestamp': ('liveInfo', 'created', {int_or_none}
),
51 'uploader': ('broadcasterInfo', 'name', {str}
),
55 'url': data
['liveInfo']['hls'],
60 '__post_extractor': self
.extract_comments(video_id
),
63 def _get_comments(self
, video_id
):
64 yield from traverse_obj(self
._download
_json
(
65 f
'https://mixch.tv/api-web/lives/{video_id}/messages', video_id
,
66 note
='Downloading comments', errnote
='Failed to download comments'), (..., {
67 'author': ('name', {str}
),
68 'author_id': ('user_id', {str_or_none}
),
69 'id': ('message_id', {str}
, {lambda x
: x
or None}),
70 'text': ('body', {str}
),
71 'timestamp': ('created', {int}
),
75 class MixchArchiveIE(InfoExtractor
):
76 IE_NAME
= 'mixch:archive'
77 _VALID_URL
= r
'https?://(?:www\.)?mixch\.tv/archive/(?P<id>\d+)'
80 'url': 'https://mixch.tv/archive/421',
81 'skip': 'paid video, no DRM. expires at Jan 23',
85 'title': '96NEKO SHOW TIME',
88 'url': 'https://mixch.tv/archive/1213',
89 'skip': 'paid video, no DRM. expires at Dec 31, 2023',
93 'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
94 'release_date': '20231201',
98 'url': 'https://mixch.tv/archive/1214',
99 'only_matching': True,
102 def _real_extract(self
, url
):
103 video_id
= self
._match
_id
(url
)
106 info_json
= self
._download
_json
(
107 f
'https://mixch.tv/api-web/archive/{video_id}', video_id
)['archive']
108 except ExtractorError
as e
:
109 if isinstance(e
.cause
, HTTPError
) and e
.cause
.status
== 401:
110 self
.raise_login_required()
115 'title': traverse_obj(info_json
, ('title', {str}
)),
116 'formats': self
._extract
_m
3u8_formats
(info_json
['archiveURL'], video_id
),
117 'thumbnail': traverse_obj(info_json
, ('thumbnailURL', {url_or_none}
)),