3 from .common
import InfoExtractor
12 class IVXPlayerIE(InfoExtractor
):
13 _VALID_URL
= r
'ivxplayer:(?P<video_id>\d+):(?P<player_key>\w+)'
15 'url': 'ivxplayer:2366065:4a89dfe6bc8f002596b1dfbd600730b1',
20 'upload_date': '20221204',
21 'title': 'Film Indonesia di Disney Content Showcase Asia Pacific 2022',
22 'timestamp': 1670151746,
23 'thumbnail': 'https://ivx-image.ivideosmart.com/serve/image/video/2366065?width=300',
27 'url': 'https://www.cantika.com/video/31737/film-indonesia-di-disney-content-showcase-asia-pacific-2022',
32 'title': 'Serial Indonesia di Disney Content Showcase Asia Pacific 2022',
33 'timestamp': 1670639416,
34 'upload_date': '20221210',
35 'thumbnail': 'https://ivx-image.ivideosmart.com/serve/image/video/2374200?width=300',
38 'url': 'https://www.gooto.com/video/11437/wuling-suv-ramai-dikunjungi-di-giias-2018',
42 'title': 'Wuling SUV Ramai Dikunjungi di GIIAS 2018',
43 'upload_date': '20180811',
44 'description': 'md5:6d901483d0aacc664aecb4489719aafa',
46 'timestamp': 1534011263,
47 'thumbnail': 'https://ivx-image.ivideosmart.com/serve/image/video/892109?width=300',
52 def _extract_embed_urls(cls
, url
, webpage
):
53 # more info at https://player.ivideosmart.com/ivsplayer/v4/dist/js/loader.js
55 r
'<ivs-player\s*[^>]+data-ivs-key\s*=\s*"(?P<player_key>[\w]+)\s*[^>]+\bdata-ivs-vid="(?P<video_id>[\w-]+)',
58 yield f
'ivxplayer:{mobj.group("video_id")}:{mobj.group("player_key")}'
59 raise cls
.StopExtraction
61 def _real_extract(self
, url
):
62 video_id
, player_key
= self
._match
_valid
_url
(url
).group('video_id', 'player_key')
63 json_data
= self
._download
_json
(
64 f
'https://ivxplayer.ivideosmart.com/prod/video/{video_id}?key={player_key}', video_id
)
66 formats
, subtitles
= self
._extract
_m
3u8_formats
_and
_subtitles
(
67 json_data
['player']['video_url'], video_id
)
70 'id': str(json_data
['ivx']['id']),
71 'title': traverse_obj(json_data
, ('ivx', 'name')),
72 'description': traverse_obj(json_data
, ('ivx', 'description')),
73 'duration': int_or_none(traverse_obj(json_data
, ('ivx', 'duration'))),
74 'timestamp': parse_iso8601(traverse_obj(json_data
, ('ivx', 'published_at'))),
76 'subtitles': subtitles
,
77 'thumbnail': traverse_obj(json_data
, ('ivx', 'thumbnail_url')),
81 class TempoIE(InfoExtractor
):
82 _VALID_URL
= r
'https?://video\.tempo\.co/\w+/\d+/(?P<id>[\w-]+)'
84 'url': 'https://video.tempo.co/read/30058/anies-baswedan-ajukan-banding-putusan-ptun-batalkan-ump-dki',
87 'display_id': 'anies-baswedan-ajukan-banding-putusan-ptun-batalkan-ump-dki',
89 'title': 'Anies Baswedan Ajukan Banding Putusan PTUN Batalkan UMP DKI',
91 'description': 'md5:a6822b7c4c874fa7e5bd63e96a387b66',
92 'thumbnail': 'https://statik.tempo.co/data/2022/07/27/id_1128287/1128287_720.jpg',
93 'timestamp': 1658907970,
94 'upload_date': '20220727',
95 'tags': ['Anies Baswedan', ' PTUN', ' PTUN | Pengadilan Tata Usaha Negara', ' PTUN Batalkan UMP DKI', ' UMP DKI'],
99 def _real_extract(self
, url
):
100 display_id
= self
._match
_id
(url
)
101 webpage
= self
._download
_webpage
(url
, display_id
)
103 _
, video_id
, player_key
= next(IVXPlayerIE
._extract
_embed
_urls
(url
, webpage
)).split(':')
105 json_ld_data
= self
._search
_json
_ld
(webpage
, display_id
)
107 return self
.url_result(
108 f
'ivxplayer:{video_id}:{player_key}', display_id
=display_id
,
109 thumbnail
=self
._html
_search
_meta
('twitter:image:src', webpage
) or self
._og
_search
_thumbnail
(webpage
),
110 tags
=try_call(lambda: self
._html
_search
_meta
('keywords', webpage
).split(',')),
111 description
=(json_ld_data
.get('description')
112 or self
._html
_search
_meta
(('description', 'twitter:description'), webpage
)
113 or self
._og
_search
_description
(webpage
)),
114 url_transparent
=True)