2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_str
16 class MediasetIE(InfoExtractor
):
21 (?:www\.)?video\.mediaset\.it/
23 (?:video|on-demand)/(?:[^/]+/)+[^/]+_|
24 player/playerIFrame(?:Twitter)?\.shtml\?.*?\bid=
30 'url': 'http://www.video.mediaset.it/video/hello_goodbye/full/quarta-puntata_661824.html',
31 'md5': '9b75534d42c44ecef7bf1ffeacb7f85d',
35 'title': 'Quarta puntata',
36 'description': 'md5:7183696d6df570e3412a5ef74b27c5e2',
37 'thumbnail': r
're:^https?://.*\.jpg$',
39 'creator': 'mediaset',
40 'upload_date': '20161107',
41 'series': 'Hello Goodbye',
42 'categories': ['reality'],
44 'expected_warnings': ['is not a supported codec'],
47 'url': 'http://www.video.mediaset.it/video/gogglebox/clip/un-grande-classico-della-commedia-sexy_661680.html',
48 'only_matching': True,
51 'url': 'http://www.video.mediaset.it/player/playerIFrame.shtml?id=665924&autoplay=true',
52 'only_matching': True,
54 # iframe twitter (from http://www.wittytv.it/se-prima-mi-fidavo-zero/)
55 'url': 'https://www.video.mediaset.it/player/playerIFrameTwitter.shtml?id=665104&playrelated=false&autoplay=false&related=true&hidesocial=true',
56 'only_matching': True,
58 'url': 'mediaset:661824',
59 'only_matching': True,
63 def _extract_urls(webpage
):
66 for mobj
in re
.finditer(
67 r
'<iframe\b[^>]+\bsrc=(["\'])(?P
<url
>https?
://(?
:www\
.)?video\
.mediaset\
.it
/player
/playerIFrame(?
:Twitter
)?\
.shtml
\?.*?
\bid
=\d
+.*?
)\
1',
70 def _real_extract(self, url):
71 video_id = self._match_id(url)
73 video_list = self._download_json(
74 'http
://cdnsel01
.mediaset
.net
/GetCdn
.aspx
',
75 video_id, 'Downloading video CDN JSON
', query={
81 for format_url in video_list:
82 if '.ism
' in format_url:
83 formats.extend(self._extract_ism_formats(
84 format_url, video_id, ism_id='mss
', fatal=False))
88 'format_id
': determine_ext(format_url),
90 self._sort_formats(formats)
92 mediainfo = self._download_json(
93 'http
://plr
.video
.mediaset
.it
/html
/metainfo
.sjson
',
94 video_id, 'Downloading video info JSON
', query={
98 title = mediainfo['title
']
101 mediainfo, lambda x: x['brand
-info
']['publisher
'], compat_str)
103 mediainfo, lambda x: x['brand
-info
']['category
'], compat_str)
104 categories = [category] if category else None
109 'description
': mediainfo.get('short
-description
'),
110 'thumbnail
': mediainfo.get('thumbnail
'),
111 'duration
': parse_duration(mediainfo.get('duration
')),
113 'upload_date
': unified_strdate(mediainfo.get('production
-date
')),
114 'webpage_url
': mediainfo.get('url
'),
115 'series
': mediainfo.get('brand
-value
'),
116 'categories
': categories,