mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 09:01:43 +00:00
[ie/theatercomplextown] Add extractors (#8560)
Closes #8491 Authored by: bashonly
This commit is contained in:
parent
c76c96677f
commit
2863fcf2b6
@ -1911,6 +1911,8 @@
|
||||
from .stacommu import (
|
||||
StacommuLiveIE,
|
||||
StacommuVODIE,
|
||||
TheaterComplexTownVODIE,
|
||||
TheaterComplexTownPPVIE,
|
||||
)
|
||||
from .stanfordoc import StanfordOpenClassroomIE
|
||||
from .startv import StarTVIE
|
||||
|
@ -38,9 +38,48 @@ def _extract_hls_key(self, data, path, decrypt):
|
||||
return None
|
||||
return traverse_obj(encryption_data, {'key': ('key', {decrypt}), 'iv': ('iv', {decrypt})})
|
||||
|
||||
def _extract_vod(self, url):
|
||||
video_id = self._match_id(url)
|
||||
video_info = self._download_metadata(
|
||||
url, video_id, 'ja', ('dehydratedState', 'queries', 0, 'state', 'data'))
|
||||
hls_info, decrypt = self._call_encrypted_api(
|
||||
video_id, ':watch', 'stream information', data={'method': 1})
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'formats': self._get_formats(hls_info, ('protocolHls', 'url', {url_or_none}), video_id),
|
||||
'hls_aes': self._extract_hls_key(hls_info, 'protocolHls', decrypt),
|
||||
**traverse_obj(video_info, {
|
||||
'title': ('displayName', {str}),
|
||||
'description': ('description', {str}),
|
||||
'timestamp': ('watchStartTime', {int_or_none}),
|
||||
'thumbnail': ('keyVisualUrl', {url_or_none}),
|
||||
'cast': ('casts', ..., 'displayName', {str}),
|
||||
'duration': ('duration', {int}),
|
||||
}),
|
||||
}
|
||||
|
||||
def _extract_ppv(self, url):
|
||||
video_id = self._match_id(url)
|
||||
video_info = self._call_api(video_id, msg='video information', query={'al': 'ja'}, auth=False)
|
||||
hls_info, decrypt = self._call_encrypted_api(
|
||||
video_id, ':watchArchive', 'stream information', data={'method': 1})
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'formats': self._get_formats(hls_info, ('hls', 'urls', ..., {url_or_none}), video_id),
|
||||
'hls_aes': self._extract_hls_key(hls_info, 'hls', decrypt),
|
||||
**traverse_obj(video_info, {
|
||||
'title': ('displayName', {str}),
|
||||
'timestamp': ('startTime', {int_or_none}),
|
||||
'thumbnail': ('keyVisualUrl', {url_or_none}),
|
||||
'duration': ('duration', {int_or_none}),
|
||||
}),
|
||||
}
|
||||
|
||||
|
||||
class StacommuVODIE(StacommuBaseIE):
|
||||
_VALID_URL = r'https?://www\.stacommu\.jp/videos/episodes/(?P<id>[\da-zA-Z]+)'
|
||||
_VALID_URL = r'https?://www\.stacommu\.jp/(?:en/)?videos/episodes/(?P<id>[\da-zA-Z]+)'
|
||||
_TESTS = [{
|
||||
# not encrypted
|
||||
'url': 'https://www.stacommu.jp/videos/episodes/aXcVKjHyAENEjard61soZZ',
|
||||
@ -79,34 +118,19 @@ class StacommuVODIE(StacommuBaseIE):
|
||||
'params': {
|
||||
'skip_download': 'm3u8',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://www.stacommu.jp/en/videos/episodes/aXcVKjHyAENEjard61soZZ',
|
||||
'only_matching': True,
|
||||
}]
|
||||
|
||||
_API_PATH = 'videoEpisodes'
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
video_info = self._download_metadata(
|
||||
url, video_id, 'ja', ('dehydratedState', 'queries', 0, 'state', 'data'))
|
||||
hls_info, decrypt = self._call_encrypted_api(
|
||||
video_id, ':watch', 'stream information', data={'method': 1})
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'formats': self._get_formats(hls_info, ('protocolHls', 'url', {url_or_none}), video_id),
|
||||
'hls_aes': self._extract_hls_key(hls_info, 'protocolHls', decrypt),
|
||||
**traverse_obj(video_info, {
|
||||
'title': ('displayName', {str}),
|
||||
'description': ('description', {str}),
|
||||
'timestamp': ('watchStartTime', {int_or_none}),
|
||||
'thumbnail': ('keyVisualUrl', {url_or_none}),
|
||||
'cast': ('casts', ..., 'displayName', {str}),
|
||||
'duration': ('duration', {int}),
|
||||
}),
|
||||
}
|
||||
return self._extract_vod(url)
|
||||
|
||||
|
||||
class StacommuLiveIE(StacommuBaseIE):
|
||||
_VALID_URL = r'https?://www\.stacommu\.jp/live/(?P<id>[\da-zA-Z]+)'
|
||||
_VALID_URL = r'https?://www\.stacommu\.jp/(?:en/)?live/(?P<id>[\da-zA-Z]+)'
|
||||
_TESTS = [{
|
||||
'url': 'https://www.stacommu.jp/live/d2FJ3zLnndegZJCAEzGM3m',
|
||||
'info_dict': {
|
||||
@ -125,24 +149,83 @@ class StacommuLiveIE(StacommuBaseIE):
|
||||
'params': {
|
||||
'skip_download': 'm3u8',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://www.stacommu.jp/en/live/d2FJ3zLnndegZJCAEzGM3m',
|
||||
'only_matching': True,
|
||||
}]
|
||||
|
||||
_API_PATH = 'events'
|
||||
|
||||
def _real_extract(self, url):
|
||||
video_id = self._match_id(url)
|
||||
video_info = self._call_api(video_id, msg='video information', query={'al': 'ja'}, auth=False)
|
||||
hls_info, decrypt = self._call_encrypted_api(
|
||||
video_id, ':watchArchive', 'stream information', data={'method': 1})
|
||||
return self._extract_ppv(url)
|
||||
|
||||
return {
|
||||
'id': video_id,
|
||||
'formats': self._get_formats(hls_info, ('hls', 'urls', ..., {url_or_none}), video_id),
|
||||
'hls_aes': self._extract_hls_key(hls_info, 'hls', decrypt),
|
||||
**traverse_obj(video_info, {
|
||||
'title': ('displayName', {str}),
|
||||
'timestamp': ('startTime', {int_or_none}),
|
||||
'thumbnail': ('keyVisualUrl', {url_or_none}),
|
||||
'duration': ('duration', {int_or_none}),
|
||||
}),
|
||||
|
||||
class TheaterComplexTownBaseIE(StacommuBaseIE):
|
||||
_NETRC_MACHINE = 'theatercomplextown'
|
||||
_API_HOST = 'api.theater-complex.town'
|
||||
_LOGIN_QUERY = {'key': 'AIzaSyAgNCqToaIz4a062EeIrkhI_xetVfAOrfc'}
|
||||
_LOGIN_HEADERS = {
|
||||
'Accept': '*/*',
|
||||
'Content-Type': 'application/json',
|
||||
'X-Client-Version': 'Chrome/JsCore/9.23.0/FirebaseCore-web',
|
||||
'Referer': 'https://www.theater-complex.town/',
|
||||
'Origin': 'https://www.theater-complex.town',
|
||||
}
|
||||
|
||||
|
||||
class TheaterComplexTownVODIE(TheaterComplexTownBaseIE):
|
||||
_VALID_URL = r'https?://(?:www\.)?theater-complex\.town/(?:en/)?videos/episodes/(?P<id>\w+)'
|
||||
IE_NAME = 'theatercomplextown:vod'
|
||||
_TESTS = [{
|
||||
'url': 'https://www.theater-complex.town/videos/episodes/hoxqidYNoAn7bP92DN6p78',
|
||||
'info_dict': {
|
||||
'id': 'hoxqidYNoAn7bP92DN6p78',
|
||||
'ext': 'mp4',
|
||||
'title': '演劇ドラフトグランプリ2023 劇団『恋のぼり』〜劇団名決定秘話ラジオ',
|
||||
'description': 'md5:a7e2e9cf570379ea67fb630f345ff65d',
|
||||
'cast': ['玉城 裕規', '石川 凌雅'],
|
||||
'thumbnail': 'https://image.theater-complex.town/5URnXX6KCeDysuFrPkP38o/5URnXX6KCeDysuFrPkP38o',
|
||||
'upload_date': '20231103',
|
||||
'timestamp': 1699016400,
|
||||
'duration': 868,
|
||||
},
|
||||
'params': {
|
||||
'skip_download': 'm3u8',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://www.theater-complex.town/en/videos/episodes/6QT7XYwM9dJz5Gf9VB6K5y',
|
||||
'only_matching': True,
|
||||
}]
|
||||
|
||||
_API_PATH = 'videoEpisodes'
|
||||
|
||||
def _real_extract(self, url):
|
||||
return self._extract_vod(url)
|
||||
|
||||
|
||||
class TheaterComplexTownPPVIE(TheaterComplexTownBaseIE):
|
||||
_VALID_URL = r'https?://(?:www\.)?theater-complex\.town/(?:en/)?ppv/(?P<id>\w+)'
|
||||
IE_NAME = 'theatercomplextown:ppv'
|
||||
_TESTS = [{
|
||||
'url': 'https://www.theater-complex.town/ppv/wytW3X7khrjJBUpKuV3jen',
|
||||
'info_dict': {
|
||||
'id': 'wytW3X7khrjJBUpKuV3jen',
|
||||
'ext': 'mp4',
|
||||
'title': 'BREAK FREE STARS 11月5日(日)12:30千秋楽公演',
|
||||
'thumbnail': 'https://image.theater-complex.town/5GWEB31JcTUfjtgdeV5t6o/5GWEB31JcTUfjtgdeV5t6o',
|
||||
'upload_date': '20231105',
|
||||
'timestamp': 1699155000,
|
||||
'duration': 8378,
|
||||
},
|
||||
'params': {
|
||||
'skip_download': 'm3u8',
|
||||
},
|
||||
}, {
|
||||
'url': 'https://www.theater-complex.town/en/ppv/wytW3X7khrjJBUpKuV3jen',
|
||||
'only_matching': True,
|
||||
}]
|
||||
|
||||
_API_PATH = 'events'
|
||||
|
||||
def _real_extract(self, url):
|
||||
return self._extract_ppv(url)
|
||||
|
Loading…
Reference in New Issue
Block a user