[vzaar] add support for AES HLS manifests(closes #17521)(closes #23299)
authorRemita Amine <remitamine@gmail.com>
Tue, 3 Dec 2019 10:37:30 +0000 (11:37 +0100)
committerRemita Amine <remitamine@gmail.com>
Tue, 3 Dec 2019 10:37:30 +0000 (11:37 +0100)
youtube_dl/extractor/vzaar.py

index 3336e6c152f80212468cc950c8da662ddf5998db..b43975eadb7b2b64b19aff088b5af1d834dd8d0f 100644 (file)
@@ -32,6 +32,15 @@ class VzaarIE(InfoExtractor):
             'ext': 'mp3',
             'title': 'MP3',
         },
+    }, {
+        # hlsAes = true
+        'url': 'https://view.vzaar.com/10165560/player',
+        'md5': '5f66f121fb28b9d16cce3d4f3df7e72e',
+        'info_dict': {
+            'id': '10165560',
+            'ext': 'mp4',
+            'title': 'Video Demo vzaar Secure.mp4',
+        },
     }, {
         # with null videoTitle
         'url': 'https://view.vzaar.com/20313539/download',
@@ -58,6 +67,7 @@ class VzaarIE(InfoExtractor):
             f = {
                 'url': source_url,
                 'format_id': 'http',
+                'preference': 1,
             }
             if 'audio' in source_url:
                 f.update({
@@ -75,12 +85,13 @@ class VzaarIE(InfoExtractor):
 
         video_guid = video_data.get('guid')
         usp = video_data.get('usp')
-        if isinstance(video_guid, compat_str) and isinstance(usp, dict):
-            m3u8_url = ('http://fable.vzaar.com/v4/usp/%s/%s.ism/.m3u8?'
-                        % (video_guid, video_id)) + '&'.join(
+        if video_data.get('uspEnabled') and isinstance(video_guid, compat_str) and isinstance(usp, dict):
+            hls_aes = video_data.get('hlsAes')
+            m3u8_url = ('http://fable.vzaar.com/v5/usp%s/%s/%s.ism/.m3u8?'
+                        % ('aes' if hls_aes else '', video_guid, video_id)) + '&'.join(
                 '%s=%s' % (k, v) for k, v in usp.items())
             formats.extend(self._extract_m3u8_formats(
-                m3u8_url, video_id, 'mp4', entry_protocol='m3u8_native',
+                m3u8_url, video_id, 'mp4', 'm3u8' if hls_aes else 'm3u8_native',
                 m3u8_id='hls', fatal=False))
 
         self._sort_formats(formats)