]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/umg.py
1 from .common
import InfoExtractor
9 class UMGDeIE(InfoExtractor
):
11 IE_DESC
= 'Universal Music Deutschland'
12 _VALID_URL
= r
'https?://(?:www\.)?universal-music\.de/[^/]+/videos/[^/?#]+-(?P<id>\d+)'
14 'url': 'https://www.universal-music.de/sido/videos/jedes-wort-ist-gold-wert-457803',
15 'md5': 'ebd90f48c80dcc82f77251eb1902634f',
19 'title': 'Jedes Wort ist Gold wert',
20 'timestamp': 1513591800,
21 'upload_date': '20171218',
25 def _real_extract(self
, url
):
26 video_id
= self
._match
_id
(url
)
27 video_data
= self
._download
_json
(
28 'https://graphql.universal-music.de/',
31 universalMusic(channel:16) {
47 }''' % video_id
})['data']['universalMusic']['video']
49 title
= video_data
['headline']
50 hls_url_template
= 'http://mediadelivery.universal-music-services.de/vod/mp4:autofill/storage/' + '/'.join(list(video_id
)) + '/content/%s/file/playlist.m3u8'
55 def add_m3u8_format(format_id
):
56 formats
.extend(self
._extract
_m
3u8_formats
(
57 hls_url_template
% format_id
, video_id
, 'mp4',
58 'm3u8_native', m3u8_id
='hls', fatal
=False))
60 for f
in video_data
.get('formats', []):
62 mime_type
= f
.get('mimeType')
63 if not f_url
or mime_type
== 'application/mxf':
67 'width': int_or_none(f
.get('width')),
68 'height': int_or_none(f
.get('height')),
69 'filesize': parse_filesize(f
.get('fileSize')),
71 f_type
= f
.get('type')
73 thumbnails
.append(fmt
)
74 elif f_type
== 'Video':
75 format_id
= f
.get('formatId')
77 fmt
['format_id'] = format_id
78 if mime_type
== 'video/mp4':
79 add_m3u8_format(format_id
)
80 urlh
= self
._request
_webpage
(f_url
, video_id
, fatal
=False)
82 first_byte
= urlh
.read(1)
83 if first_byte
not in (b
'F', b
'\x00'):
87 for format_id
in (867, 836, 940):
88 add_m3u8_format(format_id
)
93 'duration': int_or_none(video_data
.get('duration')),
94 'timestamp': parse_iso8601(video_data
.get('createdDate'), ' '),
95 'thumbnails': thumbnails
,