1 from .common
import InfoExtractor
11 class SixPlayIE(InfoExtractor
):
13 _VALID_URL
= r
'(?:6play:|https?://(?:www\.)?(?P<domain>6play\.fr|rtlplay\.be|play\.rtl\.hr|rtlmost\.hu)/.+?-c_)(?P<id>[0-9]+)'
15 'url': 'https://www.6play.fr/minute-par-minute-p_9533/le-but-qui-a-marque-lhistoire-du-football-francais-c_12041051',
16 'md5': '31fcd112637baa0c2ab92c4fcd8baf27',
20 'title': 'Le but qui a marqué l\'histoire du football français !',
21 'description': 'md5:b59e7e841d646ef1eb42a7868eb6a851',
24 'url': 'https://www.rtlplay.be/rtl-info-13h-p_8551/les-titres-du-rtlinfo-13h-c_12045869',
25 'only_matching': True,
27 'url': 'https://play.rtl.hr/pj-masks-p_9455/epizoda-34-sezona-1-catboyevo-cudo-na-dva-kotaca-c_11984989',
28 'only_matching': True,
30 'url': 'https://www.rtlmost.hu/megtorve-p_14167/megtorve-6-resz-c_12397787',
31 'only_matching': True,
34 def _real_extract(self
, url
):
35 domain
, video_id
= self
._match
_valid
_url
(url
).groups()
36 service
, consumer_name
= {
37 '6play.fr': ('6play', 'm6web'),
38 'rtlplay.be': ('rtlbe_rtl_play', 'rtlbe'),
39 'play.rtl.hr': ('rtlhr_rtl_play', 'rtlhr'),
40 'rtlmost.hu': ('rtlhu_rtl_most', 'rtlhu'),
41 }.get(domain
, ('6play', 'm6web'))
43 data
= self
._download
_json
(
44 f
'https://pc.middleware.6play.fr/6play/v2/platforms/m6group_web/services/{service}/videos/clip_{video_id}',
46 'x-customer-name': consumer_name
,
52 clip_data
= data
['clips'][0]
53 title
= clip_data
['title']
56 quality_key
= qualities(['lq', 'sd', 'hq', 'hd'])
59 assets
= clip_data
.get('assets') or []
61 asset_url
= asset
.get('full_physical_path')
62 protocol
= asset
.get('protocol')
63 if not asset_url
or ((protocol
== 'primetime' or asset
.get('type') == 'usp_hlsfp_h264') and not ('_drmnp.ism/' in asset_url
or '_unpnp.ism/' in asset_url
)) or asset_url
in urls
:
65 urls
.append(asset_url
)
66 container
= asset
.get('video_container')
67 ext
= determine_ext(asset_url
)
68 if protocol
== 'http_subtitle' or ext
== 'vtt':
69 subtitles
.setdefault('fr', []).append({'url': asset_url
})
71 if container
== 'm3u8' or ext
== 'm3u8':
73 if parse_qs(asset_url
).get('token', [None])[0]:
74 urlh
= self
._request
_webpage
(
75 asset_url
, video_id
, fatal
=False,
76 headers
=self
.geo_verification_headers())
80 asset_url
= asset_url
.replace('_drmnp.ism/', '_unpnp.ism/')
81 for i
in range(3, 0, -1):
82 asset_url
= asset_url
.replace('_sd1/', f
'_sd{i}/')
83 m3u8_formats
= self
._extract
_m
3u8_formats
(
84 asset_url
, video_id
, 'mp4', 'm3u8_native',
85 m3u8_id
='hls', fatal
=False)
86 formats
.extend(m3u8_formats
)
87 formats
.extend(self
._extract
_mpd
_formats
(
88 asset_url
.replace('.m3u8', '.mpd'),
89 video_id
, mpd_id
='dash', fatal
=False))
93 formats
.extend(self
._extract
_m
3u8_formats
(
94 asset_url
, video_id
, 'mp4', 'm3u8_native',
95 m3u8_id
='hls', fatal
=False))
96 elif container
== 'mp4' or ext
== 'mp4':
97 quality
= asset
.get('video_quality')
100 'format_id': quality
,
101 'quality': quality_key(quality
),
106 for src
in (data
, clip_data
):
107 v
= try_get(src
, getter
, str)
114 'description': get(lambda x
: x
['description']),
115 'duration': int_or_none(clip_data
.get('duration')),
116 'series': get(lambda x
: x
['program']['title']),
118 'subtitles': subtitles
,