1 from .common
import InfoExtractor
4 compat_urllib_parse_urlparse
,
14 class SkyItPlayerIE(InfoExtractor
):
15 IE_NAME
= 'player.sky.it'
16 _VALID_URL
= r
'https?://player\.sky\.it/player/(?:external|social)\.html\?.*?\bid=(?P<id>\d+)'
19 _PLAYER_TMPL
= 'https://player.sky.it/player/external.html?id=%s&domain=%s'
20 # http://static.sky.it/static/skyplayer/conf.json
22 'cielo': 'Hh9O7M8ks5yi6nSROL7bKYz933rdf3GhwZlTLMgvy4Q',
23 'hotclub': 'kW020K2jq2lk2eKRJD2vWEg832ncx2EivZlTLQput2C',
24 'mtv8': 'A5Nn9GGb326CI7vP5e27d7E4PIaQjota',
25 'salesforce': 'C6D585FD1615272C98DE38235F38BD86',
26 'sitocommerciale': 'VJwfFuSGnLKnd9Phe9y96WkXgYDCguPMJ2dLhGMb2RE',
27 'sky': 'F96WlOd8yoFmLQgiqv6fNQRvHZcsWk5jDaYnDvhbiJk',
28 'skyarte': 'LWk29hfiU39NNdq87ePeRach3nzTSV20o0lTv2001Cd',
29 'theupfront': 'PRSGmDMsg6QMGc04Obpoy7Vsbn7i2Whp',
32 def _player_url_result(self
, video_id
):
33 return self
.url_result(
34 self
._PLAYER
_TMPL
% (video_id
, self
._DOMAIN
),
35 SkyItPlayerIE
.ie_key(), video_id
)
37 def _parse_video(self
, video
, video_id
):
38 title
= video
['title']
39 is_live
= video
.get('type') == 'live'
40 hls_url
= video
.get(('streaming' if is_live
else 'hls') + '_url')
41 if not hls_url
and video
.get('geoblock' if is_live
else 'geob'):
42 self
.raise_geo_restricted(countries
=['IT'])
44 formats
= self
._extract
_m
3u8_formats
(hls_url
, video_id
, 'mp4')
50 'thumbnail': dict_get(video
, ('video_still', 'video_still_medium', 'thumb')),
51 'description': video
.get('short_desc') or None,
52 'timestamp': unified_timestamp(video
.get('create_date')),
53 'duration': int_or_none(video
.get('duration_sec')) or parse_duration(video
.get('duration')),
57 def _real_extract(self
, url
):
58 video_id
= self
._match
_id
(url
)
59 domain
= compat_parse_qs(compat_urllib_parse_urlparse(
60 url
).query
).get('domain', [None])[0]
61 token
= dict_get(self
._TOKEN
_MAP
, (domain
, 'sky'))
62 video
= self
._download
_json
(
63 'https://apid.sky.it/vdp/v1/getVideoData',
68 }, headers
=self
.geo_verification_headers())
69 return self
._parse
_video
(video
, video_id
)
72 class SkyItVideoIE(SkyItPlayerIE
): # XXX: Do not subclass from concrete IE
73 IE_NAME
= 'video.sky.it'
74 _VALID_URL
= r
'https?://(?:masterchef|video|xfactor)\.sky\.it(?:/[^/]+)*/video/[0-9a-z-]+-(?P<id>\d+)'
76 'url': 'https://video.sky.it/news/mondo/video/uomo-ucciso-da-uno-squalo-in-australia-631227',
77 'md5': '5b858a62d9ffe2ab77b397553024184a',
81 'title': 'Uomo ucciso da uno squalo in Australia',
82 'timestamp': 1606036192,
83 'upload_date': '20201122',
85 'thumbnail': 'https://video.sky.it/captures/thumbs/631227/631227_thumb_880x494.jpg',
87 'params': {'skip_download': 'm3u8'}
,
89 'url': 'https://xfactor.sky.it/video/x-factor-2020-replay-audizioni-1-615820',
90 'only_matching': True,
92 'url': 'https://masterchef.sky.it/video/masterchef-9-cosa-e-successo-nella-prima-puntata-562831',
93 'only_matching': True,
96 def _real_extract(self
, url
):
97 video_id
= self
._match
_id
(url
)
98 return self
._player
_url
_result
(video_id
)
101 class SkyItVideoLiveIE(SkyItPlayerIE
): # XXX: Do not subclass from concrete IE
102 IE_NAME
= 'video.sky.it:live'
103 _VALID_URL
= r
'https?://video\.sky\.it/diretta/(?P<id>[^/?&#]+)'
105 'url': 'https://video.sky.it/diretta/tg24',
109 'title': r
're:Diretta TG24 \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
110 'description': r
're:(?:Clicca play e )?[Gg]uarda la diretta streaming di SkyTg24, segui con Sky tutti gli appuntamenti e gli speciali di Tg24\.',
111 'live_status': 'is_live',
115 'skip_download': True,
119 def _real_extract(self
, url
):
120 display_id
= self
._match
_id
(url
)
121 webpage
= self
._download
_webpage
(url
, display_id
)
122 asset_id
= str(self
._search
_nextjs
_data
(webpage
, display_id
)['props']['initialState']['livePage']['content']['asset_id'])
123 livestream
= self
._download
_json
(
124 'https://apid.sky.it/vdp/v1/getLivestream',
125 asset_id
, query
={'id': asset_id}
)
126 return self
._parse
_video
(livestream
, asset_id
)
129 class SkyItIE(SkyItPlayerIE
): # XXX: Do not subclass from concrete IE
131 _VALID_URL
= r
'https?://(?:sport|tg24)\.sky\.it(?:/[^/]+)*/\d{4}/\d{2}/\d{2}/(?P<id>[^/?&#]+)'
133 'url': 'https://sport.sky.it/calcio/serie-a/2022/11/03/brozovic-inter-news',
137 'title': 'Brozovic con il gruppo: verso convocazione per Juve-Inter',
138 'upload_date': '20221103',
139 'timestamp': 1667484130,
141 'thumbnail': 'https://videoplatform.sky.it/still/2022/11/03/1667480526353_brozovic_videostill_1.jpg',
143 'params': {'skip_download': 'm3u8'}
,
145 'url': 'https://tg24.sky.it/mondo/2020/11/22/australia-squalo-uccide-uomo',
146 'md5': 'fe5c91e59a84a3437eaa0bca6e134ccd',
150 'title': 'Uomo ucciso da uno squalo in Australia',
151 'timestamp': 1606036192,
152 'upload_date': '20201122',
154 'thumbnail': 'https://video.sky.it/captures/thumbs/631227/631227_thumb_880x494.jpg',
156 'params': {'skip_download': 'm3u8'}
,
158 _VIDEO_ID_REGEX
= r
'data-videoid="(\d+)"'
160 def _real_extract(self
, url
):
161 display_id
= self
._match
_id
(url
)
162 webpage
= self
._download
_webpage
(url
, display_id
)
163 video_id
= self
._search
_regex
(
164 self
._VIDEO
_ID
_REGEX
, webpage
, 'video id')
165 return self
._player
_url
_result
(video_id
)
168 class SkyItArteIE(SkyItIE
): # XXX: Do not subclass from concrete IE
169 IE_NAME
= 'arte.sky.it'
170 _VALID_URL
= r
'https?://arte\.sky\.it/video/(?P<id>[^/?&#]+)'
172 'url': 'https://arte.sky.it/video/oliviero-toscani-torino-galleria-mazzoleni-788962',
173 'md5': '515aee97b87d7a018b6c80727d3e7e17',
177 'title': 'La fotografia di Oliviero Toscani conquista Torino',
178 'upload_date': '20221102',
179 'timestamp': 1667399996,
181 'thumbnail': 'https://videoplatform.sky.it/still/2022/11/02/1667396388552_oliviero-toscani-torino-galleria-mazzoleni_videostill_1.jpg',
183 'params': {'skip_download': 'm3u8'}
,
186 _VIDEO_ID_REGEX
= r
'"embedUrl"\s*:\s*"(?:https:)?//player\.sky\.it/player/external\.html\?[^"]*\bid=(\d+)'
189 class CieloTVItIE(SkyItIE
): # XXX: Do not subclass from concrete IE
190 IE_NAME
= 'cielotv.it'
191 _VALID_URL
= r
'https?://(?:www\.)?cielotv\.it/video/(?P<id>[^.]+)\.html'
193 'url': 'https://www.cielotv.it/video/Il-lunedi-e-sempre-un-dramma.html',
194 'md5': 'c4deed77552ba901c2a0d9258320304b',
198 'title': 'Il lunedì è sempre un dramma',
199 'upload_date': '20190329',
200 'timestamp': 1553862178,
202 'thumbnail': 'https://videoplatform.sky.it/still/2019/03/29/1553858575610_lunedi_dramma_mant_videostill_1.jpg',
204 'params': {'skip_download': 'm3u8'}
,
207 _VIDEO_ID_REGEX
= r
'videoId\s*=\s*"(\d+)"'
210 class TV8ItIE(SkyItVideoIE
): # XXX: Do not subclass from concrete IE
212 _VALID_URL
= r
'https?://(?:www\.)?tv8\.it/(?:show)?video/[0-9a-z-]+-(?P<id>\d+)'
214 'url': 'https://www.tv8.it/video/ogni-mattina-ucciso-asino-di-andrea-lo-cicero-630529',
215 'md5': '9ab906a3f75ea342ed928442f9dabd21',
219 'title': 'Ogni mattina - Ucciso asino di Andrea Lo Cicero',
220 'timestamp': 1605721374,
221 'upload_date': '20201118',
223 'thumbnail': 'https://videoplatform.sky.it/still/2020/11/18/1605717753954_ogni-mattina-ucciso-asino-di-andrea-lo-cicero_videostill_1.jpg',
225 'params': {'skip_download': 'm3u8'}
,