diff options
author | Damiano Amatruda <damiano.amatruda@outlook.com> | 2021-03-15 18:17:29 +0100 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-03-20 09:34:52 +0530 |
commit | 356153077695ecc89fcc4955264a32cda2e5f177 (patch) | |
tree | da88577171413d3846795266d52080b10026b7ec | |
parent | 4690688658af3d5b3f77701444f4c27cee5057fd (diff) | |
download | hypervideo-pre-356153077695ecc89fcc4955264a32cda2e5f177.tar.lz hypervideo-pre-356153077695ecc89fcc4955264a32cda2e5f177.tar.xz hypervideo-pre-356153077695ecc89fcc4955264a32cda2e5f177.zip |
Parse resolution in info dictionary (#173)
-rw-r--r-- | yt_dlp/YoutubeDL.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 6c2b9eb57..8681a18e9 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -1644,7 +1644,7 @@ class YoutubeDL(object): new_dict.update({ 'width': the_only_video.get('width'), 'height': the_only_video.get('height'), - 'resolution': the_only_video.get('resolution'), + 'resolution': the_only_video.get('resolution') or self.format_resolution(the_only_video), 'fps': the_only_video.get('fps'), 'vcodec': the_only_video.get('vcodec'), 'vbr': the_only_video.get('vbr'), @@ -2651,12 +2651,11 @@ class YoutubeDL(object): return 'audio only' if format.get('resolution') is not None: return format['resolution'] - if format.get('height') is not None: - if format.get('width') is not None: - res = '%sx%s' % (format['width'], format['height']) - else: - res = '%sp' % format['height'] - elif format.get('width') is not None: + if format.get('width') and format.get('height'): + res = '%dx%d' % (format['width'], format['height']) + elif format.get('height'): + res = '%sp' % format['height'] + elif format.get('width'): res = '%dx?' % format['width'] else: res = default |