3 from .common
import InfoExtractor
12 class SkyItPlayerIE(InfoExtractor
):
13 IE_NAME
= 'player.sky.it'
14 _VALID_URL
= r
'https?://player\.sky\.it/player/(?:external|social)\.html\?.*?\bid=(?P<id>\d+)'
17 _PLAYER_TMPL
= 'https://player.sky.it/player/external.html?id=%s&domain=%s'
18 # http://static.sky.it/static/skyplayer/conf.json
20 'cielo': 'Hh9O7M8ks5yi6nSROL7bKYz933rdf3GhwZlTLMgvy4Q',
21 'hotclub': 'kW020K2jq2lk2eKRJD2vWEg832ncx2EivZlTLQput2C',
22 'mtv8': 'A5Nn9GGb326CI7vP5e27d7E4PIaQjota',
23 'salesforce': 'C6D585FD1615272C98DE38235F38BD86',
24 'sitocommerciale': 'VJwfFuSGnLKnd9Phe9y96WkXgYDCguPMJ2dLhGMb2RE',
25 'sky': 'F96WlOd8yoFmLQgiqv6fNQRvHZcsWk5jDaYnDvhbiJk',
26 'skyarte': 'LWk29hfiU39NNdq87ePeRach3nzTSV20o0lTv2001Cd',
27 'theupfront': 'PRSGmDMsg6QMGc04Obpoy7Vsbn7i2Whp',
30 def _player_url_result(self
, video_id
):
31 return self
.url_result(
32 self
._PLAYER
_TMPL
% (video_id
, self
._DOMAIN
),
33 SkyItPlayerIE
.ie_key(), video_id
)
35 def _parse_video(self
, video
, video_id
):
36 title
= video
['title']
37 is_live
= video
.get('type') == 'live'
38 hls_url
= video
.get(('streaming' if is_live
else 'hls') + '_url')
39 if not hls_url
and video
.get('geoblock' if is_live
else 'geob'):
40 self
.raise_geo_restricted(countries
=['IT'])
42 formats
= self
._extract
_m
3u8_formats
(hls_url
, video_id
, 'mp4')
48 'thumbnail': dict_get(video
, ('video_still', 'video_still_medium', 'thumb')),
49 'description': video
.get('short_desc') or None,
50 'timestamp': unified_timestamp(video
.get('create_date')),
51 'duration': int_or_none(video
.get('duration_sec')) or parse_duration(video
.get('duration')),
55 def _real_extract(self
, url
):
56 video_id
= self
._match
_id
(url
)
57 domain
= urllib
.parse
.parse_qs(urllib
.parse
.urlparse(
58 url
).query
).get('domain', [None])[0]
59 token
= dict_get(self
._TOKEN
_MAP
, (domain
, 'sky'))
60 video
= self
._download
_json
(
61 'https://apid.sky.it/vdp/v1/getVideoData',
66 }, headers
=self
.geo_verification_headers())
67 return self
._parse
_video
(video
, video_id
)
70 class SkyItVideoIE(SkyItPlayerIE
): # XXX: Do not subclass from concrete IE
71 IE_NAME
= 'video.sky.it'
72 _VALID_URL
= r
'https?://(?:masterchef|video|xfactor)\.sky\.it(?:/[^/]+)*/video/[0-9a-z-]+-(?P<id>\d+)'
74 'url': 'https://video.sky.it/news/mondo/video/uomo-ucciso-da-uno-squalo-in-australia-631227',
75 'md5': '5b858a62d9ffe2ab77b397553024184a',
79 'title': 'Uomo ucciso da uno squalo in Australia',
80 'timestamp': 1606036192,
81 'upload_date': '20201122',
83 'thumbnail': 'https://video.sky.it/captures/thumbs/631227/631227_thumb_880x494.jpg',
85 'params': {'skip_download': 'm3u8'},
87 'url': 'https://xfactor.sky.it/video/x-factor-2020-replay-audizioni-1-615820',
88 'only_matching': True,
90 'url': 'https://masterchef.sky.it/video/masterchef-9-cosa-e-successo-nella-prima-puntata-562831',
91 'only_matching': True,
94 def _real_extract(self
, url
):
95 video_id
= self
._match
_id
(url
)
96 return self
._player
_url
_result
(video_id
)
99 class SkyItVideoLiveIE(SkyItPlayerIE
): # XXX: Do not subclass from concrete IE
100 IE_NAME
= 'video.sky.it:live'
101 _VALID_URL
= r
'https?://video\.sky\.it/diretta/(?P<id>[^/?&#]+)'
103 'url': 'https://video.sky.it/diretta/tg24',
107 'title': r
're:Diretta TG24 \d{4}-\d{2}-\d{2} \d{2}:\d{2}',
108 'description': r
're:(?:Clicca play e )?[Gg]uarda la diretta streaming di SkyTg24, segui con Sky tutti gli appuntamenti e gli speciali di Tg24\.',
109 'live_status': 'is_live',
113 'skip_download': True,
117 def _real_extract(self
, url
):
118 display_id
= self
._match
_id
(url
)
119 webpage
= self
._download
_webpage
(url
, display_id
)
120 asset_id
= str(self
._search
_nextjs
_data
(webpage
, display_id
)['props']['initialState']['livePage']['content']['asset_id'])
121 livestream
= self
._download
_json
(
122 'https://apid.sky.it/vdp/v1/getLivestream',
123 asset_id
, query
={'id': asset_id
})
124 return self
._parse
_video
(livestream
, asset_id
)
127 class SkyItIE(SkyItPlayerIE
): # XXX: Do not subclass from concrete IE
129 _VALID_URL
= r
'https?://(?:sport|tg24)\.sky\.it(?:/[^/]+)*/\d{4}/\d{2}/\d{2}/(?P<id>[^/?&#]+)'
131 'url': 'https://sport.sky.it/calcio/serie-a/2022/11/03/brozovic-inter-news',
135 'title': 'Brozovic con il gruppo: verso convocazione per Juve-Inter',
136 'upload_date': '20221103',
137 'timestamp': 1667484130,
139 'thumbnail': 'https://videoplatform.sky.it/still/2022/11/03/1667480526353_brozovic_videostill_1.jpg',
141 'params': {'skip_download': 'm3u8'},
143 'url': 'https://tg24.sky.it/mondo/2020/11/22/australia-squalo-uccide-uomo',
144 'md5': 'fe5c91e59a84a3437eaa0bca6e134ccd',
148 'title': 'Uomo ucciso da uno squalo in Australia',
149 'timestamp': 1606036192,
150 'upload_date': '20201122',
152 'thumbnail': 'https://video.sky.it/captures/thumbs/631227/631227_thumb_880x494.jpg',
154 'params': {'skip_download': 'm3u8'},
156 _VIDEO_ID_REGEX
= r
'data-videoid="(\d+)"'
158 def _real_extract(self
, url
):
159 display_id
= self
._match
_id
(url
)
160 webpage
= self
._download
_webpage
(url
, display_id
)
161 video_id
= self
._search
_regex
(
162 self
._VIDEO
_ID
_REGEX
, webpage
, 'video id')
163 return self
._player
_url
_result
(video_id
)
166 class SkyItArteIE(SkyItIE
): # XXX: Do not subclass from concrete IE
167 IE_NAME
= 'arte.sky.it'
168 _VALID_URL
= r
'https?://arte\.sky\.it/video/(?P<id>[^/?&#]+)'
170 'url': 'https://arte.sky.it/video/oliviero-toscani-torino-galleria-mazzoleni-788962',
171 'md5': '515aee97b87d7a018b6c80727d3e7e17',
175 'title': 'La fotografia di Oliviero Toscani conquista Torino',
176 'upload_date': '20221102',
177 'timestamp': 1667399996,
179 'thumbnail': 'https://videoplatform.sky.it/still/2022/11/02/1667396388552_oliviero-toscani-torino-galleria-mazzoleni_videostill_1.jpg',
181 'params': {'skip_download': 'm3u8'},
184 _VIDEO_ID_REGEX
= r
'"embedUrl"\s*:\s*"(?:https:)?//player\.sky\.it/player/external\.html\?[^"]*\bid=(\d+)'
187 class CieloTVItIE(SkyItIE
): # XXX: Do not subclass from concrete IE
188 IE_NAME
= 'cielotv.it'
189 _VALID_URL
= r
'https?://(?:www\.)?cielotv\.it/video/(?P<id>[^.]+)\.html'
191 'url': 'https://www.cielotv.it/video/Il-lunedi-e-sempre-un-dramma.html',
192 'md5': 'c4deed77552ba901c2a0d9258320304b',
196 'title': 'Il lunedì è sempre un dramma',
197 'upload_date': '20190329',
198 'timestamp': 1553862178,
200 'thumbnail': 'https://videoplatform.sky.it/still/2019/03/29/1553858575610_lunedi_dramma_mant_videostill_1.jpg',
202 'params': {'skip_download': 'm3u8'},
205 _VIDEO_ID_REGEX
= r
'videoId\s*=\s*"(\d+)"'
208 class TV8ItIE(SkyItVideoIE
): # XXX: Do not subclass from concrete IE
210 _VALID_URL
= r
'https?://(?:www\.)?tv8\.it/(?:show)?video/[0-9a-z-]+-(?P<id>\d+)'
212 'url': 'https://www.tv8.it/video/ogni-mattina-ucciso-asino-di-andrea-lo-cicero-630529',
213 'md5': '9ab906a3f75ea342ed928442f9dabd21',
217 'title': 'Ogni mattina - Ucciso asino di Andrea Lo Cicero',
218 'timestamp': 1605721374,
219 'upload_date': '20201118',
221 'thumbnail': 'https://videoplatform.sky.it/still/2020/11/18/1605717753954_ogni-mattina-ucciso-asino-di-andrea-lo-cicero_videostill_1.jpg',
223 'params': {'skip_download': 'm3u8'},