about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-09-08 22:52:39 +0700
committerSergey M․ <dstftw@gmail.com>2016-09-08 22:53:20 +0700
commit37720844f6d40878bd2f29ea8311c7988ed3fc6a (patch)
treed3494ea3bd4c9714d08ff0af0cc411a62e5ee1f1
parent6cfcb8ac3634f1735093a791fa56b96bddabe14b (diff)
downloadyoutube-dl-37720844f6d40878bd2f29ea8311c7988ed3fc6a.tar.gz
youtube-dl-37720844f6d40878bd2f29ea8311c7988ed3fc6a.tar.xz
youtube-dl-37720844f6d40878bd2f29ea8311c7988ed3fc6a.zip
[jwplatform] Extract height from label
-rw-r--r--youtube_dl/extractor/jwplatform.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/youtube_dl/extractor/jwplatform.py b/youtube_dl/extractor/jwplatform.py
index ce3126943..7aaa65476 100644
--- a/youtube_dl/extractor/jwplatform.py
+++ b/youtube_dl/extractor/jwplatform.py
@@ -63,10 +63,17 @@ class JWPlatformBaseIE(InfoExtractor):
                         'ext': ext,
                     })
                 else:
+                    height = int_or_none(source.get('height'))
+                    if height is None:
+                        # Often no height is provided but there is a label in
+                        # format like 1080p.
+                        height = int_or_none(self._search_regex(
+                            r'^(\d{3,})[pP]$', source.get('label') or '',
+                            'height', default=None))
                     a_format = {
                         'url': source_url,
                         'width': int_or_none(source.get('width')),
-                        'height': int_or_none(source.get('height')),
+                        'height': height,
                         'ext': ext,
                     }
                     if source_url.startswith('rtmp'):