]>
jfr.im git - yt-dlp.git/blob - youtube_dlc/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://api.universal-music.de/graphql',
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 m3u8_formats
= self
._extract
_m
3u8_formats
(
60 hls_url_template
% format_id
, video_id
, 'mp4',
61 'm3u8_native', m3u8_id
='hls', fatal
='False')
62 if m3u8_formats
and m3u8_formats
[0].get('height'):
63 formats
.extend(m3u8_formats
)
65 for f
in video_data
.get('formats', []):
67 mime_type
= f
.get('mimeType')
68 if not f_url
or mime_type
== 'application/mxf':
72 'width': int_or_none(f
.get('width')),
73 'height': int_or_none(f
.get('height')),
74 'filesize': parse_filesize(f
.get('fileSize')),
76 f_type
= f
.get('type')
78 thumbnails
.append(fmt
)
79 elif f_type
== 'Video':
80 format_id
= f
.get('formatId')
82 fmt
['format_id'] = format_id
83 if mime_type
== 'video/mp4':
84 add_m3u8_format(format_id
)
85 urlh
= self
._request
_webpage
(f_url
, video_id
, fatal
=False)
87 first_byte
= urlh
.read(1)
88 if first_byte
not in (b
'F', b
'\x00'):
92 for format_id
in (867, 836, 940):
93 add_m3u8_format(format_id
)
94 self
._sort
_formats
(formats
, ('width', 'height', 'filesize', 'tbr'))
99 'duration': int_or_none(video_data
.get('duration')),
100 'timestamp': parse_iso8601(video_data
.get('createdDate'), ' '),
101 'thumbnails': thumbnails
,