]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/fourzerostudio.py
1 from .common
import InfoExtractor
2 from ..utils
import traverse_obj
, unified_timestamp
5 class FourZeroStudioArchiveIE(InfoExtractor
):
6 _VALID_URL
= r
'https?://0000\.studio/(?P<uploader_id>[^/]+)/broadcasts/(?P<id>[^/]+)/archive'
7 IE_NAME
= '0000studio:archive'
9 'url': 'https://0000.studio/mumeijiten/broadcasts/1290f433-fce0-4909-a24a-5f7df09665dc/archive',
11 'id': '1290f433-fce0-4909-a24a-5f7df09665dc',
12 'title': 'noteで『canape』様へのファンレターを執筆します。(数秘術その2)',
13 'timestamp': 1653802534,
14 'release_timestamp': 1653796604,
15 'thumbnails': 'count:1',
16 'comments': 'count:7',
17 'uploader': '『中崎雄心』の執務室。',
18 'uploader_id': 'mumeijiten',
22 def _real_extract(self
, url
):
23 video_id
, uploader_id
= self
._match
_valid
_url
(url
).group('id', 'uploader_id')
24 webpage
= self
._download
_webpage
(url
, video_id
)
25 nuxt_data
= self
._search
_nuxt
_data
(webpage
, video_id
, traverse
=None)
27 pcb
= traverse_obj(nuxt_data
, ('ssrRefs', lambda _
, v
: v
['__typename'] == 'PublicCreatorBroadcast'), get_all
=False)
28 uploader_internal_id
= traverse_obj(nuxt_data
, (
29 'ssrRefs', lambda _
, v
: v
['__typename'] == 'PublicUser', 'id'), get_all
=False)
31 formats
, subs
= self
._extract
_m
3u8_formats
_and
_subtitles
(pcb
['archiveUrl'], video_id
, ext
='mp4')
32 self
._sort
_formats
(formats
)
36 'title': pcb
.get('title'),
37 'age_limit': 18 if pcb
.get('isAdult') else None,
38 'timestamp': unified_timestamp(pcb
.get('finishTime')),
39 'release_timestamp': unified_timestamp(pcb
.get('createdAt')),
41 'url': pcb
['thumbnailUrl'],
43 }] if pcb
.get('thumbnailUrl') else None,
47 'author': c
.get('username'),
48 'author_id': c
.get('postedUserId'),
49 'author_thumbnail': c
.get('userThumbnailUrl'),
51 'text': c
.get('body'),
52 'timestamp': unified_timestamp(c
.get('createdAt')),
53 'like_count': c
.get('likeCount'),
54 'is_favorited': c
.get('isLikedByOwner'),
55 'author_is_uploader': c
.get('postedUserId') == uploader_internal_id
,
56 } for c
in traverse_obj(nuxt_data
, (
57 'ssrRefs', ..., lambda _
, v
: v
['__typename'] == 'PublicCreatorBroadcastComment')) or []],
58 'uploader_id': uploader_id
,
59 'uploader': traverse_obj(nuxt_data
, (
60 'ssrRefs', lambda _
, v
: v
['__typename'] == 'PublicUser', 'username'), get_all
=False),
64 class FourZeroStudioClipIE(InfoExtractor
):
65 _VALID_URL
= r
'https?://0000\.studio/(?P<uploader_id>[^/]+)/archive-clip/(?P<id>[^/]+)'
66 IE_NAME
= '0000studio:clip'
68 'url': 'https://0000.studio/soeji/archive-clip/e46b0278-24cd-40a8-92e1-b8fc2b21f34f',
70 'id': 'e46b0278-24cd-40a8-92e1-b8fc2b21f34f',
71 'title': 'わたベーさんからイラスト差し入れいただきました。ありがとうございました!',
72 'timestamp': 1652109105,
74 'uploader': 'ソエジマケイタ',
75 'uploader_id': 'soeji',
79 def _real_extract(self
, url
):
80 video_id
, uploader_id
= self
._match
_valid
_url
(url
).group('id', 'uploader_id')
81 webpage
= self
._download
_webpage
(url
, video_id
)
82 nuxt_data
= self
._search
_nuxt
_data
(webpage
, video_id
, traverse
=None)
84 clip_info
= traverse_obj(nuxt_data
, ('ssrRefs', lambda _
, v
: v
['__typename'] == 'PublicCreatorArchivedClip'), get_all
=False)
87 m
for m
in self
._parse
_html
5_media
_entries
(url
, webpage
, video_id
)
88 if 'mp4' in traverse_obj(m
, ('formats', ..., 'ext'))
91 self
.report_warning('Failed to find a desired media element. Falling back to using NUXT data.')
96 } for url
in clip_info
.get('mediaFiles') or [] if url
],
101 'title': clip_info
.get('clipComment'),
102 'timestamp': unified_timestamp(clip_info
.get('createdAt')),
103 'like_count': clip_info
.get('likeCount'),
104 'uploader_id': uploader_id
,
105 'uploader': traverse_obj(nuxt_data
, (
106 'ssrRefs', lambda _
, v
: v
['__typename'] == 'PublicUser', 'username'), get_all
=False),