[youtube] Fix parsing codecs (closes #12091)
authorSergey M․ <dstftw@gmail.com>
Sun, 12 Feb 2017 11:09:53 +0000 (18:09 +0700)
committerSergey M․ <dstftw@gmail.com>
Sun, 12 Feb 2017 11:09:53 +0000 (18:09 +0700)
youtube_dl/extractor/youtube.py

index 76710931ae5e6a292af767f3f57685ad0be98cac..dec02804bf52770719f7f29b7fe893f22b26cc5f 100644 (file)
@@ -34,6 +34,7 @@ from ..utils import (
     int_or_none,
     mimetype2ext,
     orderedSet,
+    parse_codecs,
     parse_duration,
     remove_quotes,
     remove_start,
@@ -1696,15 +1697,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
                                     codecs = mobj.group('val')
                                     break
                             if codecs:
-                                codecs = codecs.split(',')
-                                if len(codecs) == 2:
-                                    acodec, vcodec = codecs[1], codecs[0]
-                                else:
-                                    acodec, vcodec = (codecs[0], 'none') if kind == 'audio' else ('none', codecs[0])
-                                dct.update({
-                                    'acodec': acodec,
-                                    'vcodec': vcodec,
-                                })
+                                dct.update(parse_codecs(codecs))
                 formats.append(dct)
         elif video_info.get('hlsvp'):
             manifest_url = video_info['hlsvp'][0]