summary refs log tree commit diff
diff options
context:
space:
mode:
authorJan Kundrát <jkt@flaska.net>2017-05-12 17:16:50 +0200
committerSergey M․ <dstftw@gmail.com>2017-05-28 06:19:46 +0700
commit765522345fcdf726df9b520314fb8802c2fa8459 (patch)
treece26e2af8e08e192b418ce72203e156ac94e82b7
parent6bceb36b9939b2fcc8417cc734fa9e376d67e4f2 (diff)
downloadyoutube-dl-765522345fcdf726df9b520314fb8802c2fa8459.tar.gz
youtube-dl-765522345fcdf726df9b520314fb8802c2fa8459.tar.xz
youtube-dl-765522345fcdf726df9b520314fb8802c2fa8459.zip
[dvtv] Parse adaptive formats as well
The old code hit an error when it attempted to parse the string
"adaptive" for video height. Actually parsing the returned playlists is
a good idea because it adds more output formats, including some
audio-only-ones.
-rw-r--r--youtube_dl/extractor/dvtv.py31
1 files changed, 24 insertions, 7 deletions
diff --git a/youtube_dl/extractor/dvtv.py b/youtube_dl/extractor/dvtv.py
index 974c69dbc..b1ae37d78 100644
--- a/youtube_dl/extractor/dvtv.py
+++ b/youtube_dl/extractor/dvtv.py
@@ -71,6 +71,14 @@ class DVTVIE(InfoExtractor):
     }, {
         'url': 'http://video.aktualne.cz/v-cechach-poprve-zazni-zelenkova-zrestaurovana-mse/r~45b4b00483ec11e4883b002590604f2e/',
         'only_matching': True,
+    }, {
+        'url': 'https://video.aktualne.cz/dvtv/zeman-si-jen-leci-mindraky-sobotku-nenavidi-a-babis-se-mu-te/r~960cdb3a365a11e7a83b0025900fea04/',
+        'md5': 'f8efe9656017da948369aa099788c8ea',
+        'info_dict': {
+            'id': '3c496fec365911e7a6500025900fea04',
+            'ext': 'm3u8',
+            'title': 'Zeman si jen léčí mindráky, Sobotku nenávidí a Babiš se mu teď hodí, tvrdí Kmenta',
+        }
     }]
 
     def _parse_video_metadata(self, js, video_id):
@@ -79,13 +87,22 @@ class DVTVIE(InfoExtractor):
         formats = []
         for video in metadata['sources']:
             ext = video['type'][6:]
-            formats.append({
-                'url': video['file'],
-                'ext': ext,
-                'format_id': '%s-%s' % (ext, video['label']),
-                'height': int(video['label'].rstrip('p')),
-                'fps': 25,
-            })
+            if video['label'] != 'adaptive':
+                formats.append({
+                    'url': video['file'],
+                    'ext': ext,
+                    'format_id': '%s-%s' % (ext, video['label']),
+                    'height': int(video['label'].rstrip('p')),
+                    'fps': 25,
+                })
+            elif video['type'] == 'application/dash+xml':
+                formats.extend(self._extract_mpd_formats(video['file'],
+                                                         video_id,
+                                                         fatal=False))
+            elif video['type'] == 'application/vnd.apple.mpegurl':
+                formats.extend(self._extract_m3u8_formats(video['file'],
+                                                          video_id,
+                                                          fatal=False))
 
         self._sort_formats(formats)