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 'skyacademy': 'A6LAn7EkO2Q26FRy0IAMBekX6jzDXYL3',
29 'skyarte': 'LWk29hfiU39NNdq87ePeRach3nzTSV20o0lTv2001Cd',
30 'theupfront': 'PRSGmDMsg6QMGc04Obpoy7Vsbn7i2Whp',
33 def _player_url_result(self
, video_id
):
34 return self
.url_result(
35 self
._PLAYER
_TMPL
% (video_id
, self
._DOMAIN
),
36 SkyItPlayerIE
.ie_key(), video_id
)
38 def _parse_video(self
, video
, video_id
):
39 title
= video
['title']
40 is_live
= video
.get('type') == 'live'
41 hls_url
= video
.get(('streaming' if is_live
else 'hls') + '_url')
42 if not hls_url
and video
.get('geoblock' if is_live
else 'geob'):
43 self
.raise_geo_restricted(countries
=['IT'])
46 formats
= self
._extract
_m
3u8_formats
(hls_url
, video_id
, 'mp4')
48 formats
= self
._extract
_akamai
_formats
(
49 hls_url
, video_id
, {'http': 'videoplatform.sky.it'}
)
50 self
._sort
_formats
(formats
)
56 'thumbnail': dict_get(video
, ('video_still', 'video_still_medium', 'thumb')),
57 'description': video
.get('short_desc') or None,
58 'timestamp': unified_timestamp(video
.get('create_date')),
59 'duration': int_or_none(video
.get('duration_sec')) or parse_duration(video
.get('duration')),
63 def _real_extract(self
, url
):
64 video_id
= self
._match
_id
(url
)
65 domain
= compat_parse_qs(compat_urllib_parse_urlparse(
66 url
).query
).get('domain', [None])[0]
67 token
= dict_get(self
._TOKEN
_MAP
, (domain
, 'sky'))
68 video
= self
._download
_json
(
69 'https://apid.sky.it/vdp/v1/getVideoData',
74 }, headers
=self
.geo_verification_headers())
75 return self
._parse
_video
(video
, video_id
)
78 class SkyItVideoIE(SkyItPlayerIE
):
79 IE_NAME
= 'video.sky.it'
80 _VALID_URL
= r
'https?://(?:masterchef|video|xfactor)\.sky\.it(?:/[^/]+)*/video/[0-9a-z-]+-(?P<id>\d+)'
82 'url': 'https://video.sky.it/news/mondo/video/uomo-ucciso-da-uno-squalo-in-australia-631227',
83 'md5': 'fe5c91e59a84a3437eaa0bca6e134ccd',
87 'title': 'Uomo ucciso da uno squalo in Australia',
88 'timestamp': 1606036192,
89 'upload_date': '20201122',
92 'url': 'https://xfactor.sky.it/video/x-factor-2020-replay-audizioni-1-615820',
93 'only_matching': True,
95 'url': 'https://masterchef.sky.it/video/masterchef-9-cosa-e-successo-nella-prima-puntata-562831',
96 'only_matching': True,
99 def _real_extract(self
, url
):
100 video_id
= self
._match
_id
(url
)
101 return self
._player
_url
_result
(video_id
)
104 class SkyItVideoLiveIE(SkyItPlayerIE
):
105 IE_NAME
= 'video.sky.it:live'
106 _VALID_URL
= r
'https?://video\.sky\.it/diretta/(?P<id>[^/?&#]+)'
108 'url': 'https://video.sky.it/diretta/tg24',
112 'title': r
're:Diretta TG24 \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
113 'description': 'Guarda la diretta streaming di SkyTg24, segui con Sky tutti gli appuntamenti e gli speciali di Tg24.',
117 'skip_download': True,
121 def _real_extract(self
, url
):
122 display_id
= self
._match
_id
(url
)
123 webpage
= self
._download
_webpage
(url
, display_id
)
124 asset_id
= str(self
._search
_nextjs
_data
(webpage
, display_id
)['props']['initialState']['livePage']['content']['asset_id'])
125 livestream
= self
._download
_json
(
126 'https://apid.sky.it/vdp/v1/getLivestream',
127 asset_id
, query
={'id': asset_id}
)
128 return self
._parse
_video
(livestream
, asset_id
)
131 class SkyItIE(SkyItPlayerIE
):
133 _VALID_URL
= r
'https?://(?:sport|tg24)\.sky\.it(?:/[^/]+)*/\d{4}/\d{2}/\d{2}/(?P<id>[^/?&#]+)'
135 'url': 'https://sport.sky.it/calcio/serie-a/2020/11/21/juventus-cagliari-risultato-gol',
139 'title': 'Un rosso alla violenza: in campo per i diritti delle donne',
140 'upload_date': '20201121',
141 'timestamp': 1605995753,
143 'expected_warnings': ['Unable to download f4m manifest'],
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',
155 _VIDEO_ID_REGEX
= r
'data-videoid="(\d+)"'
157 def _real_extract(self
, url
):
158 display_id
= self
._match
_id
(url
)
159 webpage
= self
._download
_webpage
(url
, display_id
)
160 video_id
= self
._search
_regex
(
161 self
._VIDEO
_ID
_REGEX
, webpage
, 'video id')
162 return self
._player
_url
_result
(video_id
)
165 class SkyItAcademyIE(SkyItIE
):
166 IE_NAME
= 'skyacademy.it'
167 _VALID_URL
= r
'https?://(?:www\.)?skyacademy\.it(?:/[^/]+)*/\d{4}/\d{2}/\d{2}/(?P<id>[^/?&#]+)'
169 'url': 'https://www.skyacademy.it/eventi-speciali/2019/07/05/a-lezione-di-cinema-con-sky-academy-/',
170 'md5': 'ced5c26638b7863190cbc44dd6f6ba08',
174 'title': 'Sky Academy "The Best CineCamp 2019"',
175 'timestamp': 1562843784,
176 'upload_date': '20190711',
179 _DOMAIN
= 'skyacademy'
180 _VIDEO_ID_REGEX
= r
'id="news-videoId_(\d+)"'
183 class SkyItArteIE(SkyItIE
):
184 IE_NAME
= 'arte.sky.it'
185 _VALID_URL
= r
'https?://arte\.sky\.it/video/(?P<id>[^/?&#]+)'
187 'url': 'https://arte.sky.it/video/serie-musei-venezia-collezionismo-12-novembre/',
188 'md5': '515aee97b87d7a018b6c80727d3e7e17',
192 'title': "Musei Galleria Franchetti alla Ca' d'Oro Palazzo Grimani",
193 'upload_date': '20201106',
194 'timestamp': 1604664493,
198 _VIDEO_ID_REGEX
= r
'(?s)<iframe[^>]+src="(?:https:)?//player\.sky\.it/player/external\.html\?[^"]*\bid=(\d+)'
201 class CieloTVItIE(SkyItIE
):
202 IE_NAME
= 'cielotv.it'
203 _VALID_URL
= r
'https?://(?:www\.)?cielotv\.it/video/(?P<id>[^.]+)\.html'
205 'url': 'https://www.cielotv.it/video/Il-lunedi-e-sempre-un-dramma.html',
206 'md5': 'c4deed77552ba901c2a0d9258320304b',
210 'title': 'Il lunedì è sempre un dramma',
211 'upload_date': '20190329',
212 'timestamp': 1553862178,
216 _VIDEO_ID_REGEX
= r
'videoId\s*=\s*"(\d+)"'
219 class TV8ItIE(SkyItVideoIE
):
221 _VALID_URL
= r
'https?://tv8\.it/showvideo/(?P<id>\d+)'
223 'url': 'https://tv8.it/showvideo/630529/ogni-mattina-ucciso-asino-di-andrea-lo-cicero/18-11-2020/',
224 'md5': '9ab906a3f75ea342ed928442f9dabd21',
228 'title': 'Ogni mattina - Ucciso asino di Andrea Lo Cicero',
229 'timestamp': 1605721374,
230 'upload_date': '20201118',