]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/mixch.py
1 from .common
import InfoExtractor
2 from ..networking
.exceptions
import HTTPError
3 from ..utils
import ExtractorError
, UserNotLive
, int_or_none
, url_or_none
4 from ..utils
.traversal
import traverse_obj
7 class MixchIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://(?:www\.)?mixch\.tv/u/(?P<id>\d+)'
12 'url': 'https://mixch.tv/u/16236849/live',
13 'skip': 'don\'t know if this live persists',
16 'title': '24配信シェア⭕️投票🙏💦',
17 'comment_count': 13145,
19 'timestamp': 1636189377,
20 'uploader': '🦥伊咲👶🏻#フレアワ',
21 'uploader_id': '16236849',
24 'url': 'https://mixch.tv/u/16137876/live',
25 'only_matching': True,
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
30 data
= self
._download
_json
(f
'https://mixch.tv/api-web/users/{video_id}/live', video_id
)
31 if not traverse_obj(data
, ('liveInfo', {dict}
)):
32 raise UserNotLive(video_id
=video_id
)
36 'uploader_id': video_id
,
37 **traverse_obj(data
, {
38 'title': ('liveInfo', 'title', {str}
),
39 'comment_count': ('liveInfo', 'comments', {int_or_none}
),
40 'view_count': ('liveInfo', 'visitor', {int_or_none}
),
41 'timestamp': ('liveInfo', 'created', {int_or_none}
),
42 'uploader': ('broadcasterInfo', 'name', {str}
),
46 'url': data
['liveInfo']['hls'],
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',
64 'title': '96NEKO SHOW TIME',
67 'url': 'https://mixch.tv/archive/1213',
68 'skip': 'paid video, no DRM. expires at Dec 31, 2023',
72 'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
73 'release_date': '20231201',
77 'url': 'https://mixch.tv/archive/1214',
78 'only_matching': True,
81 def _real_extract(self
, url
):
82 video_id
= self
._match
_id
(url
)
85 info_json
= self
._download
_json
(
86 f
'https://mixch.tv/api-web/archive/{video_id}', video_id
)['archive']
87 except ExtractorError
as e
:
88 if isinstance(e
.cause
, HTTPError
) and e
.cause
.status
== 401:
89 self
.raise_login_required()
94 'title': traverse_obj(info_json
, ('title', {str}
)),
95 'formats': self
._extract
_m
3u8_formats
(info_json
['archiveURL'], video_id
),
96 'thumbnail': traverse_obj(info_json
, ('thumbnailURL', {url_or_none}
)),