diff options
| author | Sergey M․ <dstftw@gmail.com> | 2014-09-01 20:13:04 +0700 | 
|---|---|---|
| committer | Sergey M․ <dstftw@gmail.com> | 2014-09-01 20:13:04 +0700 | 
| commit | 9ebf22b7d9a696b34566046366d11a9c5f8445c0 (patch) | |
| tree | f12356204c2adb8a2cd0cf99ad1118feb87ff530 | |
| parent | 2582bebe06cf06cd2bdce9ada7764fccc3730ef4 (diff) | |
[common] Improve codecs extraction from m3u8
| -rw-r--r-- | youtube_dl/extractor/common.py | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 8453321c5..929dd1e97 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -677,9 +677,12 @@ class InfoExtractor(object):                  }                  codecs = last_info.get('CODECS')                  if codecs: -                    video, audio = codecs.split(',') -                    f['vcodec'] = video.partition('.')[0] -                    f['acodec'] = audio.partition('.')[0] +                    # TODO: looks like video codec is not always necessarily goes first +                    va_codecs = codecs.split(',') +                    if va_codecs[0]: +                        f['vcodec'] = va_codecs[0].partition('.')[0] +                    if len(va_codecs) > 1 and va_codecs[1]: +                        f['acodec'] = va_codecs[1].partition('.')[0]                  resolution = last_info.get('RESOLUTION')                  if resolution:                      width_str, height_str = resolution.split('x') | 
