]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[common] recognize hls manifests that contain video only formats(#11394)
authorRemita Amine <remitamine@gmail.com>
Sat, 10 Dec 2016 16:17:13 +0000 (17:17 +0100)
committerRemita Amine <remitamine@gmail.com>
Sat, 10 Dec 2016 16:22:15 +0000 (17:22 +0100)
youtube_dl/extractor/cbc.py
youtube_dl/extractor/common.py
youtube_dl/extractor/msn.py

index d71fddf58a068461cd2d377b31e4c3981d6c2b3d..7c76ceac8977efe832eecad9e5283869d70f9e7b 100644 (file)
@@ -283,11 +283,6 @@ class CBCWatchVideoIE(CBCWatchBaseIE):
         formats = self._extract_m3u8_formats(re.sub(r'/([^/]+)/[^/?]+\.m3u8', r'/\1/\1.m3u8', m3u8_url), video_id, 'mp4', fatal=False)
         if len(formats) < 2:
             formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4')
-        # Despite metadata in m3u8 all video+audio formats are
-        # actually video-only (no audio)
-        for f in formats:
-            if f.get('acodec') != 'none' and f.get('vcodec') != 'none':
-                f['acodec'] = 'none'
         self._sort_formats(formats)
 
         info = {
index 05c51fac9b0b4162fb126cb79a79d871b591ead8..6ae946569095a4e6e82a8ff5f04580aa3229ee3a 100644 (file)
@@ -1224,6 +1224,7 @@ class InfoExtractor(object):
                 'protocol': entry_protocol,
                 'preference': preference,
             }]
+        audio_groups = set()
         last_info = {}
         last_media = {}
         for line in m3u8_doc.splitlines():
@@ -1239,15 +1240,18 @@ class InfoExtractor(object):
                         for v in (media.get('GROUP-ID'), media.get('NAME')):
                             if v:
                                 format_id.append(v)
-                        formats.append({
+                        f = {
                             'format_id': '-'.join(format_id),
                             'url': format_url(media_url),
                             'language': media.get('LANGUAGE'),
-                            'vcodec': 'none' if media_type == 'AUDIO' else None,
                             'ext': ext,
                             'protocol': entry_protocol,
                             'preference': preference,
-                        })
+                        }
+                        if media_type == 'AUDIO':
+                            f['vcodec'] = 'none'
+                            audio_groups.add(media['GROUP-ID'])
+                        formats.append(f)
                     else:
                         # When there is no URI in EXT-X-MEDIA let this tag's
                         # data be used by regular URI lines below
@@ -1295,6 +1299,9 @@ class InfoExtractor(object):
                         'abr': abr,
                     })
                 f.update(parse_codecs(last_info.get('CODECS')))
+                if last_info.get('AUDIO') in audio_groups:
+                    # TODO: update acodec for for audio only formats with the same GROUP-ID
+                    f['acodec'] = 'none'
                 formats.append(f)
                 last_info = {}
                 last_media = {}
index d75ce8b3b510b68ca0dfe754d8fcf1741e6cbd9d..1473bcf4845d4b8470393686a7bd9baf1df0e398 100644 (file)
@@ -78,11 +78,6 @@ class MSNIE(InfoExtractor):
                 m3u8_formats = self._extract_m3u8_formats(
                     format_url, display_id, 'mp4',
                     m3u8_id='hls', fatal=False)
-                # Despite metadata in m3u8 all video+audio formats are
-                # actually video-only (no audio)
-                for f in m3u8_formats:
-                    if f.get('acodec') != 'none' and f.get('vcodec') != 'none':
-                        f['acodec'] = 'none'
                 formats.extend(m3u8_formats)
             else:
                 formats.append({