1 from .common
import InfoExtractor
9 from ..utils
.traversal
import traverse_obj
12 class UlizaPlayerIE(InfoExtractor
):
13 _VALID_URL
= r
'https://player-api\.p\.uliza\.jp/v1/players/[^?#]+\?(?:[^#]*&)?name=(?P<id>[^#&]+)'
15 'url': 'https://player-api.p.uliza.jp/v1/players/timeshift-disabled/pia/admin?type=normal&playerobjectname=ulizaPlayer&name=livestream01_dvr&repeatable=true',
17 'id': '88f3109a-f503-4d0f-a9f7-9f39ac745d84',
19 'title': '88f3109a-f503-4d0f-a9f7-9f39ac745d84',
20 'live_status': 'was_live',
21 '_old_archive_ids': ['piaulizaportal 88f3109a-f503-4d0f-a9f7-9f39ac745d84'],
24 'url': 'https://player-api.p.uliza.jp/v1/players/uliza_jp_gallery_normal/promotion/admin?type=presentation&name=cookings&targetid=player1',
26 'id': 'ae350126-5e22-4a7f-a8ac-8d0fd448b800',
28 'title': 'ae350126-5e22-4a7f-a8ac-8d0fd448b800',
29 'live_status': 'not_live',
30 '_old_archive_ids': ['piaulizaportal ae350126-5e22-4a7f-a8ac-8d0fd448b800'],
33 'url': 'https://player-api.p.uliza.jp/v1/players/default-player/pia/admin?type=normal&name=pia_movie_uliza_fix&targetid=ulizahtml5&repeatable=true',
35 'id': '0644ecc8-e354-41b4-b957-3b08a2d63df1',
37 'title': '0644ecc8-e354-41b4-b957-3b08a2d63df1',
38 'live_status': 'not_live',
39 '_old_archive_ids': ['piaulizaportal 0644ecc8-e354-41b4-b957-3b08a2d63df1'],
43 def _real_extract(self
, url
):
44 display_id
= self
._match
_id
(url
)
45 player_data
= self
._download
_webpage
(
46 url
, display_id
, headers
={'Referer': 'https://player-api.p.uliza.jp/'},
47 note
='Fetching player data', errnote
='Unable to fetch player data')
49 m3u8_url
= self
._search
_regex
(
50 r
'["\'](https
://vms
-api\
.p\
.uliza\
.jp
/v1
/prog
-index\
.m3u8
[^
"\']+)', player_data, 'm3u8 url')
51 video_id = parse_qs(m3u8_url).get('ss', [display_id])[0]
53 formats = self._extract_m3u8_formats(m3u8_url, video_id)
54 m3u8_type = self._search_regex(
55 r'/hls/(dvr|video)/', traverse_obj(formats, (0, 'url')), 'm3u8 type', default=None)
62 'dvr': 'was_live', # short-term archives
63 }.get(m3u8_type, 'not_live'), # VOD or long-term archives
64 '_old_archive_ids': [make_archive_id('PIAULIZAPortal', video_id)],
68 class UlizaPortalIE(InfoExtractor):
69 IE_DESC = 'ulizaportal.jp'
70 _VALID_URL = r'https?://(?:www\.)?ulizaportal\.jp/pages/(?P<id>[\da-f]{8}-(?:[\da-f]{4}-){3}[\da-f]{12})'
72 'url': 'https://ulizaportal.jp/pages/005f18b7-e810-5618-cb82-0987c5755d44',
74 'id': 'ae350126-5e22-4a7f-a8ac-8d0fd448b800',
75 'display_id': '005f18b7-e810-5618-cb82-0987c5755d44',
76 'title': 'プレゼンテーションプレイヤーのサンプル',
77 'live_status': 'not_live',
78 '_old_archive_ids': ['piaulizaportal ae350126-5e22-4a7f-a8ac-8d0fd448b800'],
81 'skip_download': True,
82 'ignore_no_formats_error': True,
85 'url': 'https://ulizaportal.jp/pages/005e1b23-fe93-5780-19a0-98e917cc4b7d?expires=4102412400&signature=f422a993b683e1068f946caf406d211c17d1ef17da8bef3df4a519502155aa91&version=1',
87 'id': '0644ecc8-e354-41b4-b957-3b08a2d63df1',
88 'display_id': '005e1b23-fe93-5780-19a0-98e917cc4b7d',
89 'title': '【確認用】視聴サンプルページ(ULIZA)',
90 'live_status': 'not_live',
91 '_old_archive_ids': ['piaulizaportal 0644ecc8-e354-41b4-b957-3b08a2d63df1'],
94 'skip_download': True,
95 'ignore_no_formats_error': True,
99 def _real_extract(self, url):
100 video_id = self._match_id(url)
102 expires = int_or_none(traverse_obj(parse_qs(url), ('expires', 0)))
103 if expires and expires <= time_seconds():
104 raise ExtractorError('The link is expired', video_id=video_id, expected=True)
106 webpage = self._download_webpage(url, video_id)
108 player_data_url = self._search_regex(
109 r'<script [^>]*\bsrc="(https
://player
-api\
.p\
.uliza\
.jp
/v1
/players
/[^
"]+)"',
110 webpage, 'player data url
')
111 return self.url_result(
112 player_data_url, UlizaPlayerIE, url_transparent=True,
113 display_id=video_id, video_title=self._html_extract_title(webpage))