2023-09-23 22:15:01 +00:00
|
|
|
|
from .common import InfoExtractor
|
2024-08-28 14:35:13 +00:00
|
|
|
|
from ..utils import ExtractorError, int_or_none, parse_qs, time_seconds
|
|
|
|
|
from ..utils.traversal import traverse_obj
|
2024-08-21 03:43:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PIAULIZAPortalAPIIE(InfoExtractor):
|
2024-09-09 13:13:03 +00:00
|
|
|
|
_VALID_URL = r'https://player-api\.p\.uliza\.jp/v1/players/[^?#]+\?(?:[^#]*&)?name=(?P<id>[^#&]+)'
|
2024-08-21 03:43:45 +00:00
|
|
|
|
_TESTS = [
|
|
|
|
|
{
|
|
|
|
|
'url': 'https://player-api.p.uliza.jp/v1/players/timeshift-disabled/pia/admin?type=normal&playerobjectname=ulizaPlayer&name=livestream01_dvr&repeatable=true',
|
|
|
|
|
'info_dict': {
|
2024-08-21 15:55:59 +00:00
|
|
|
|
'id': '88f3109a-f503-4d0f-a9f7-9f39ac745d84',
|
|
|
|
|
'title': '88f3109a-f503-4d0f-a9f7-9f39ac745d84',
|
2024-08-21 03:43:45 +00:00
|
|
|
|
'live_status': 'was_live',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'url': 'https://player-api.p.uliza.jp/v1/players/uliza_jp_gallery_normal/promotion/admin?type=presentation&name=cookings&targetid=player1',
|
|
|
|
|
'info_dict': {
|
2024-08-21 15:55:59 +00:00
|
|
|
|
'id': 'ae350126-5e22-4a7f-a8ac-8d0fd448b800',
|
|
|
|
|
'title': 'ae350126-5e22-4a7f-a8ac-8d0fd448b800',
|
2024-08-21 03:43:45 +00:00
|
|
|
|
'live_status': 'not_live',
|
|
|
|
|
},
|
|
|
|
|
'params': {
|
|
|
|
|
'skip_download': True,
|
|
|
|
|
'ignore_no_formats_error': True,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
'url': 'https://player-api.p.uliza.jp/v1/players/default-player/pia/admin?type=normal&name=pia_movie_uliza_fix&targetid=ulizahtml5&repeatable=true',
|
|
|
|
|
'info_dict': {
|
2024-08-21 15:55:59 +00:00
|
|
|
|
'id': '0644ecc8-e354-41b4-b957-3b08a2d63df1',
|
|
|
|
|
'title': '0644ecc8-e354-41b4-b957-3b08a2d63df1',
|
2024-08-21 03:43:45 +00:00
|
|
|
|
'live_status': 'not_live',
|
|
|
|
|
},
|
|
|
|
|
'params': {
|
|
|
|
|
'skip_download': True,
|
|
|
|
|
'ignore_no_formats_error': True,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2024-09-09 13:13:03 +00:00
|
|
|
|
display_id = self._match_id(url)
|
2024-08-21 03:43:45 +00:00
|
|
|
|
player_data = self._download_webpage(
|
2024-08-23 15:12:18 +00:00
|
|
|
|
url, tmp_video_id, headers={'Referer': 'https://player-api.p.uliza.jp/'},
|
2024-08-21 03:43:45 +00:00
|
|
|
|
note='Fetching player data', errnote='Unable to fetch player data',
|
|
|
|
|
)
|
|
|
|
|
|
2024-09-09 13:13:03 +00:00
|
|
|
|
player_data = self._search_json(
|
|
|
|
|
r'var\s+params\s*=', player_js, 'json', display_id,
|
|
|
|
|
transform_source=js_to_json)
|
2024-08-21 15:55:59 +00:00
|
|
|
|
|
2024-08-23 02:01:07 +00:00
|
|
|
|
video_id = self._search_regex(r'&?ss=([\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12})&?', m3u8_url, 'video id', default=tmp_video_id)
|
2024-08-21 15:55:59 +00:00
|
|
|
|
|
2024-08-21 03:43:45 +00:00
|
|
|
|
formats = self._extract_m3u8_formats(
|
2024-08-21 15:55:59 +00:00
|
|
|
|
m3u8_url,
|
2024-08-21 03:43:45 +00:00
|
|
|
|
video_id, fatal=False)
|
|
|
|
|
m3u8_type = self._search_regex(
|
|
|
|
|
r'/hls/(dvr|video)/', traverse_obj(formats, (0, 'url')), 'm3u8 type', default=None)
|
|
|
|
|
return {
|
|
|
|
|
'id': video_id,
|
2024-08-23 02:01:07 +00:00
|
|
|
|
'title': video_id,
|
2024-08-21 03:43:45 +00:00
|
|
|
|
'formats': formats,
|
|
|
|
|
'live_status': {
|
|
|
|
|
'video': 'is_live',
|
|
|
|
|
'dvr': 'was_live', # short-term archives
|
|
|
|
|
}.get(m3u8_type, 'not_live'), # VOD or long-term archives
|
|
|
|
|
}
|
2023-09-23 22:15:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class PIAULIZAPortalIE(InfoExtractor):
|
|
|
|
|
IE_DESC = 'ulizaportal.jp - PIA LIVE STREAM'
|
|
|
|
|
_VALID_URL = r'https?://(?:www\.)?ulizaportal\.jp/pages/(?P<id>[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12})'
|
|
|
|
|
_TESTS = [{
|
|
|
|
|
'url': 'https://ulizaportal.jp/pages/005f18b7-e810-5618-cb82-0987c5755d44',
|
|
|
|
|
'info_dict': {
|
2024-08-24 09:44:14 +00:00
|
|
|
|
'id': 'ae350126-5e22-4a7f-a8ac-8d0fd448b800',
|
|
|
|
|
'display_id': '005f18b7-e810-5618-cb82-0987c5755d44',
|
2023-09-23 22:15:01 +00:00
|
|
|
|
'title': 'プレゼンテーションプレイヤーのサンプル',
|
|
|
|
|
'live_status': 'not_live',
|
|
|
|
|
},
|
|
|
|
|
'params': {
|
|
|
|
|
'skip_download': True,
|
|
|
|
|
'ignore_no_formats_error': True,
|
|
|
|
|
},
|
|
|
|
|
}, {
|
|
|
|
|
'url': 'https://ulizaportal.jp/pages/005e1b23-fe93-5780-19a0-98e917cc4b7d?expires=4102412400&signature=f422a993b683e1068f946caf406d211c17d1ef17da8bef3df4a519502155aa91&version=1',
|
|
|
|
|
'info_dict': {
|
2024-08-24 09:44:14 +00:00
|
|
|
|
'id': '0644ecc8-e354-41b4-b957-3b08a2d63df1',
|
|
|
|
|
'display_id': '005e1b23-fe93-5780-19a0-98e917cc4b7d',
|
2023-09-23 22:15:01 +00:00
|
|
|
|
'title': '【確認用】視聴サンプルページ(ULIZA)',
|
|
|
|
|
'live_status': 'not_live',
|
|
|
|
|
},
|
|
|
|
|
'params': {
|
|
|
|
|
'skip_download': True,
|
|
|
|
|
'ignore_no_formats_error': True,
|
|
|
|
|
},
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
|
|
|
|
|
|
expires = int_or_none(traverse_obj(parse_qs(url), ('expires', 0)))
|
|
|
|
|
if expires and expires <= time_seconds():
|
|
|
|
|
raise ExtractorError('The link is expired.', video_id=video_id, expected=True)
|
|
|
|
|
|
|
|
|
|
webpage = self._download_webpage(url, video_id)
|
|
|
|
|
|
2024-08-21 03:43:45 +00:00
|
|
|
|
player_data_url = self._search_regex(
|
2024-08-24 15:34:06 +00:00
|
|
|
|
r'<script [^>]*\bsrc="(https://player-api\.p\.uliza\.jp/v1/players/[^"]+)"',
|
2024-08-21 03:43:45 +00:00
|
|
|
|
webpage, 'player data url')
|
|
|
|
|
return self.url_result(
|
2024-08-28 14:35:13 +00:00
|
|
|
|
player_data_url, url_transparent=True,
|
2024-08-28 14:48:42 +00:00
|
|
|
|
display_id=video_id, video_title=self._html_extract_title(webpage))
|