Parse resolution in info dictionary (#173)

This commit is contained in:
Damiano Amatruda 2021-03-15 18:17:29 +01:00 committed by pukkandan
parent 4690688658
commit 3561530776
No known key found for this signature in database
GPG Key ID: 0F00D95A001F4698
1 changed files with 6 additions and 7 deletions

View File

@ -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:
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') is not None:
elif format.get('width'):
res = '%dx?' % format['width']
else:
res = default