]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/umg.py
2 from __future__
import unicode_literals
4 from .common
import InfoExtractor
12 class UMGDeIE(InfoExtractor
):
14 IE_DESC
= 'Universal Music Deutschland'
15 _VALID_URL
= r
'https?://(?:www\.)?universal-music\.de/[^/]+/videos/[^/?#]+-(?P<id>\d+)'
17 'url': 'https://www.universal-music.de/sido/videos/jedes-wort-ist-gold-wert-457803',
18 'md5': 'ebd90f48c80dcc82f77251eb1902634f',
22 'title': 'Jedes Wort ist Gold wert',
23 'timestamp': 1513591800,
24 'upload_date': '20171218',
28 def _real_extract(self
, url
):
29 video_id
= self
._match
_id
(url
)
30 video_data
= self
._download
_json
(
31 'https://graphql.universal-music.de/',
34 universalMusic(channel:16) {
50 }''' % video_id
})['data']['universalMusic']['video']
52 title
= video_data
['headline']
53 hls_url_template
= 'http://mediadelivery.universal-music-services.de/vod/mp4:autofill/storage/' + '/'.join(list(video_id
)) + '/content/%s/file/playlist.m3u8'
58 def add_m3u8_format(format_id
):
59 formats
.extend(self
._extract
_m
3u8_formats
(
60 hls_url_template
% format_id
, video_id
, 'mp4',
61 'm3u8_native', m3u8_id
='hls', fatal
=False))
63 for f
in video_data
.get('formats', []):
65 mime_type
= f
.get('mimeType')
66 if not f_url
or mime_type
== 'application/mxf':
70 'width': int_or_none(f
.get('width')),
71 'height': int_or_none(f
.get('height')),
72 'filesize': parse_filesize(f
.get('fileSize')),
74 f_type
= f
.get('type')
76 thumbnails
.append(fmt
)
77 elif f_type
== 'Video':
78 format_id
= f
.get('formatId')
80 fmt
['format_id'] = format_id
81 if mime_type
== 'video/mp4':
82 add_m3u8_format(format_id
)
83 urlh
= self
._request
_webpage
(f_url
, video_id
, fatal
=False)
85 first_byte
= urlh
.read(1)
86 if first_byte
not in (b
'F', b
'\x00'):
90 for format_id
in (867, 836, 940):
91 add_m3u8_format(format_id
)
92 self
._sort
_formats
(formats
)
97 'duration': int_or_none(video_data
.get('duration')),
98 'timestamp': parse_iso8601(video_data
.get('createdDate'), ' '),
99 'thumbnails': thumbnails
,