2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
7 compat_urllib_parse_urlparse
,
17 class SkyItPlayerIE(InfoExtractor
):
18 IE_NAME
= 'player.sky.it'
19 _VALID_URL
= r
'https?://player\.sky\.it/player/(?:external|social)\.html\?.*?\bid=(?P<id>\d+)'
22 _PLAYER_TMPL
= 'https://player.sky.it/player/external.html?id=%s&domain=%s'
23 # http://static.sky.it/static/skyplayer/conf.json
25 'cielo': 'Hh9O7M8ks5yi6nSROL7bKYz933rdf3GhwZlTLMgvy4Q',
26 'hotclub': 'kW020K2jq2lk2eKRJD2vWEg832ncx2EivZlTLQput2C',
27 'mtv8': 'A5Nn9GGb326CI7vP5e27d7E4PIaQjota',
28 'salesforce': 'C6D585FD1615272C98DE38235F38BD86',
29 'sitocommerciale': 'VJwfFuSGnLKnd9Phe9y96WkXgYDCguPMJ2dLhGMb2RE',
30 'sky': 'F96WlOd8yoFmLQgiqv6fNQRvHZcsWk5jDaYnDvhbiJk',
31 'skyacademy': 'A6LAn7EkO2Q26FRy0IAMBekX6jzDXYL3',
32 'skyarte': 'LWk29hfiU39NNdq87ePeRach3nzTSV20o0lTv2001Cd',
33 'theupfront': 'PRSGmDMsg6QMGc04Obpoy7Vsbn7i2Whp',
36 def _player_url_result(self
, video_id
):
37 return self
.url_result(
38 self
._PLAYER
_TMPL
% (video_id
, self
._DOMAIN
),
39 SkyItPlayerIE
.ie_key(), video_id
)
41 def _parse_video(self
, video
, video_id
):
42 title
= video
['title']
43 is_live
= video
.get('type') == 'live'
44 hls_url
= video
.get(('streaming' if is_live
else 'hls') + '_url')
45 if not hls_url
and video
.get('geoblock' if is_live
else 'geob'):
46 self
.raise_geo_restricted(countries
=['IT'])
49 formats
= self
._extract
_m
3u8_formats
(hls_url
, video_id
, 'mp4')
51 formats
= self
._extract
_akamai
_formats
(
52 hls_url
, video_id
, {'http': 'videoplatform.sky.it'}
)
53 self
._sort
_formats
(formats
)
59 'thumbnail': dict_get(video
, ('video_still', 'video_still_medium', 'thumb')),
60 'description': video
.get('short_desc') or None,
61 'timestamp': unified_timestamp(video
.get('create_date')),
62 'duration': int_or_none(video
.get('duration_sec')) or parse_duration(video
.get('duration')),
66 def _real_extract(self
, url
):
67 video_id
= self
._match
_id
(url
)
68 domain
= compat_parse_qs(compat_urllib_parse_urlparse(
69 url
).query
).get('domain', [None])[0]
70 token
= dict_get(self
._TOKEN
_MAP
, (domain
, 'sky'))
71 video
= self
._download
_json
(
72 'https://apid.sky.it/vdp/v1/getVideoData',
77 }, headers
=self
.geo_verification_headers())
78 return self
._parse
_video
(video
, video_id
)
81 class SkyItVideoIE(SkyItPlayerIE
):
82 IE_NAME
= 'video.sky.it'
83 _VALID_URL
= r
'https?://(?:masterchef|video|xfactor)\.sky\.it(?:/[^/]+)*/video/[0-9a-z-]+-(?P<id>\d+)'
85 'url': 'https://video.sky.it/news/mondo/video/uomo-ucciso-da-uno-squalo-in-australia-631227',
86 'md5': 'fe5c91e59a84a3437eaa0bca6e134ccd',
90 'title': 'Uomo ucciso da uno squalo in Australia',
91 'timestamp': 1606036192,
92 'upload_date': '20201122',
95 'url': 'https://xfactor.sky.it/video/x-factor-2020-replay-audizioni-1-615820',
96 'only_matching': True,
98 'url': 'https://masterchef.sky.it/video/masterchef-9-cosa-e-successo-nella-prima-puntata-562831',
99 'only_matching': True,
102 def _real_extract(self
, url
):
103 video_id
= self
._match
_id
(url
)
104 return self
._player
_url
_result
(video_id
)
107 class SkyItVideoLiveIE(SkyItPlayerIE
):
108 IE_NAME
= 'video.sky.it:live'
109 _VALID_URL
= r
'https?://video\.sky\.it/diretta/(?P<id>[^/?&#]+)'
111 'url': 'https://video.sky.it/diretta/tg24',
115 'title': r
're:Diretta TG24 \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
116 'description': 'Guarda la diretta streaming di SkyTg24, segui con Sky tutti gli appuntamenti e gli speciali di Tg24.',
120 'skip_download': True,
124 def _real_extract(self
, url
):
125 display_id
= self
._match
_id
(url
)
126 webpage
= self
._download
_webpage
(url
, display_id
)
127 asset_id
= str(self
._search
_nextjs
_data
(webpage
, display_id
)['props']['initialState']['livePage']['content']['asset_id'])
128 livestream
= self
._download
_json
(
129 'https://apid.sky.it/vdp/v1/getLivestream',
130 asset_id
, query
={'id': asset_id}
)
131 return self
._parse
_video
(livestream
, asset_id
)
134 class SkyItIE(SkyItPlayerIE
):
136 _VALID_URL
= r
'https?://(?:sport|tg24)\.sky\.it(?:/[^/]+)*/\d{4}/\d{2}/\d{2}/(?P<id>[^/?&#]+)'
138 'url': 'https://sport.sky.it/calcio/serie-a/2020/11/21/juventus-cagliari-risultato-gol',
142 'title': 'Un rosso alla violenza: in campo per i diritti delle donne',
143 'upload_date': '20201121',
144 'timestamp': 1605995753,
146 'expected_warnings': ['Unable to download f4m manifest'],
148 'url': 'https://tg24.sky.it/mondo/2020/11/22/australia-squalo-uccide-uomo',
149 'md5': 'fe5c91e59a84a3437eaa0bca6e134ccd',
153 'title': 'Uomo ucciso da uno squalo in Australia',
154 'timestamp': 1606036192,
155 'upload_date': '20201122',
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 SkyItAcademyIE(SkyItIE
):
169 IE_NAME
= 'skyacademy.it'
170 _VALID_URL
= r
'https?://(?:www\.)?skyacademy\.it(?:/[^/]+)*/\d{4}/\d{2}/\d{2}/(?P<id>[^/?&#]+)'
172 'url': 'https://www.skyacademy.it/eventi-speciali/2019/07/05/a-lezione-di-cinema-con-sky-academy-/',
173 'md5': 'ced5c26638b7863190cbc44dd6f6ba08',
177 'title': 'Sky Academy "The Best CineCamp 2019"',
178 'timestamp': 1562843784,
179 'upload_date': '20190711',
182 _DOMAIN
= 'skyacademy'
183 _VIDEO_ID_REGEX
= r
'id="news-videoId_(\d+)"'
186 class SkyItArteIE(SkyItIE
):
187 IE_NAME
= 'arte.sky.it'
188 _VALID_URL
= r
'https?://arte\.sky\.it/video/(?P<id>[^/?&#]+)'
190 'url': 'https://arte.sky.it/video/serie-musei-venezia-collezionismo-12-novembre/',
191 'md5': '515aee97b87d7a018b6c80727d3e7e17',
195 'title': "Musei Galleria Franchetti alla Ca' d'Oro Palazzo Grimani",
196 'upload_date': '20201106',
197 'timestamp': 1604664493,
201 _VIDEO_ID_REGEX
= r
'(?s)<iframe[^>]+src="(?:https:)?//player\.sky\.it/player/external\.html\?[^"]*\bid=(\d+)'
204 class CieloTVItIE(SkyItIE
):
205 IE_NAME
= 'cielotv.it'
206 _VALID_URL
= r
'https?://(?:www\.)?cielotv\.it/video/(?P<id>[^.]+)\.html'
208 'url': 'https://www.cielotv.it/video/Il-lunedi-e-sempre-un-dramma.html',
209 'md5': 'c4deed77552ba901c2a0d9258320304b',
213 'title': 'Il lunedì è sempre un dramma',
214 'upload_date': '20190329',
215 'timestamp': 1553862178,
219 _VIDEO_ID_REGEX
= r
'videoId\s*=\s*"(\d+)"'
222 class TV8ItIE(SkyItVideoIE
):
224 _VALID_URL
= r
'https?://tv8\.it/showvideo/(?P<id>\d+)'
226 'url': 'https://tv8.it/showvideo/630529/ogni-mattina-ucciso-asino-di-andrea-lo-cicero/18-11-2020/',
227 'md5': '9ab906a3f75ea342ed928442f9dabd21',
231 'title': 'Ogni mattina - Ucciso asino di Andrea Lo Cicero',
232 'timestamp': 1605721374,
233 'upload_date': '20201118',