1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-27 17:08:32 +00:00
This commit is contained in:
Izra 2025-06-17 16:23:11 +01:00 committed by GitHub
commit 5ced113ebd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,7 +7,7 @@
class AsobiStageIE(InfoExtractor):
IE_DESC = 'ASOBISTAGE (アソビステージ)'
_VALID_URL = r'https?://asobistage\.asobistore\.jp/event/(?P<id>(?P<event>\w+)/(?P<type>archive|player)/(?P<slug>\w+))(?:[?#]|$)'
_VALID_URL = r'https?://asobistage\.asobistore\.jp/event/(?P<id>(?P<event>\w+)/(?P<type>archive|player|premium_lp)/(?P<slug>\w+))(?:[?#]|$)'
_TESTS = [{
'url': 'https://asobistage.asobistore.jp/event/315passionhour_2022summer/archive/frame',
'info_dict': {
@ -51,6 +51,13 @@ class AsobiStageIE(InfoExtractor):
}, {
'url': 'https://asobistage.asobistore.jp/event/ijigenfes_utagassen/player/day1',
'only_matching': True,
}, {
'url': 'https://asobistage.asobistore.jp/event/gakuen_1stperiod/premium_lp/ss_premium',
'info_dict': {
'id': 'gakuen_1stperiod/premium_lp/ss_premium',
'title': '学園アイドルマスター The 1st Period Spotlight Star DAYスペシャル視聴チケット特典',
},
'playlist_count': 2,
}]
_API_HOST = 'https://asobistage-api.asobistore.jp'
@ -103,6 +110,10 @@ def _real_initialize(self):
def _real_extract(self, url):
webpage, urlh = self._download_webpage_handle(url, self._match_id(url))
video_id, event, type_, slug = self._match_valid_url(urlh.url).group('id', 'event', 'type', 'slug')
if type_ == 'premium_lp':
return self._extract_premium_lp(video_id, event, slug)
video_type = {'archive': 'archives', 'player': 'broadcasts'}[type_]
event_data = traverse_obj(
@ -153,3 +164,44 @@ def _real_extract(self, url):
self.raise_login_required()
return self.playlist_result(entries, video_id, **event_data)
def _extract_premium_lp(self, video_id, event, slug):
contents = traverse_obj(self._download_json(
f'https://asobistage.asobistore.jp/cdn/v101/events/{event}/premium_lp.json',
video_id, 'Getting content list', 'Unable to get content list'), (
'contents', lambda _, v: v['premium_lp_slug'] == slug))
if not contents:
self.report_warning(f'No content found for event "{event}"')
return None
root_content = contents[0]
event_data = {
'title': root_content.get('title'),
}
entries = []
for content in traverse_obj(root_content, ('contentList', ..., 'contents', ...)):
movie_url = content.get('movieUrl')
channel_id = movie_url.rsplit('/', 1)[-1]
channel_json = self._download_json(
f'https://survapi.channel.or.jp/proxy/v1/contents/{channel_id}/get_by_cuid', channel_id,
'Getting archive channel info', 'Unable to get archive channel info', fatal=False,
headers=self._HEADERS)
channel_data = traverse_obj(channel_json, ('ex_content', {
'm3u8_url': 'streaming_url',
'title': 'title',
'thumbnail': ('thumbnail', 'url'),
}))
entries.append({
'id': channel_id,
'title': channel_data.get('title'),
'formats': self._extract_m3u8_formats(channel_data.get('m3u8_url'), channel_id, fatal=False),
'is_live': False,
'thumbnail': url_or_none(channel_data.get('thumbnail')),
})
if not self._is_logged_in and not entries:
self.raise_login_required()
return self.playlist_result(entries, video_id, **event_data)