1 from .common
import InfoExtractor
9 class UMGDeIE(InfoExtractor
):
12 IE_DESC
= 'Universal Music Deutschland'
13 _VALID_URL
= r
'https?://(?:www\.)?universal-music\.de/[^/]+/videos/[^/?#]+-(?P<id>\d+)'
15 'url': 'https://www.universal-music.de/sido/videos/jedes-wort-ist-gold-wert-457803',
16 'md5': 'ebd90f48c80dcc82f77251eb1902634f',
20 'title': 'Jedes Wort ist Gold wert',
21 'timestamp': 1513591800,
22 'upload_date': '20171218',
26 def _real_extract(self
, url
):
27 video_id
= self
._match
_id
(url
)
28 video_data
= self
._download
_json
(
29 'https://graphql.universal-music.de/',
32 universalMusic(channel:16) {
48 }''' % video_id
})['data']['universalMusic']['video'] # noqa: UP031
50 title
= video_data
['headline']
51 hls_url_template
= 'http://mediadelivery.universal-music-services.de/vod/mp4:autofill/storage/' + '/'.join(list(video_id
)) + '/content/%s/file/playlist.m3u8'
56 def add_m3u8_format(format_id
):
57 formats
.extend(self
._extract
_m
3u8_formats
(
58 hls_url_template
% format_id
, video_id
, 'mp4',
59 'm3u8_native', m3u8_id
='hls', fatal
=False))
61 for f
in video_data
.get('formats', []):
63 mime_type
= f
.get('mimeType')
64 if not f_url
or mime_type
== 'application/mxf':
68 'width': int_or_none(f
.get('width')),
69 'height': int_or_none(f
.get('height')),
70 'filesize': parse_filesize(f
.get('fileSize')),
72 f_type
= f
.get('type')
74 thumbnails
.append(fmt
)
75 elif f_type
== 'Video':
76 format_id
= f
.get('formatId')
78 fmt
['format_id'] = format_id
79 if mime_type
== 'video/mp4':
80 add_m3u8_format(format_id
)
81 urlh
= self
._request
_webpage
(f_url
, video_id
, fatal
=False)
83 first_byte
= urlh
.read(1)
84 if first_byte
not in (b
'F', b
'\x00'):
88 for format_id
in (867, 836, 940):
89 add_m3u8_format(format_id
)
94 'duration': int_or_none(video_data
.get('duration')),
95 'timestamp': parse_iso8601(video_data
.get('createdDate'), ' '),
96 'thumbnails': thumbnails
,