0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-18 01:35:12 +00:00

[YoutubeIE] Add width and height to format dict

This commit is contained in:
rzhxeo 2013-12-18 21:21:25 +01:00
parent 4ea3be0a5c
commit dbd1988ed9

View file

@ -219,54 +219,54 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
'248': 'webm',
}
_video_dimensions = {
'5': '400x240',
'6': '???',
'13': '???',
'17': '176x144',
'18': '640x360',
'22': '1280x720',
'34': '640x360',
'35': '854x480',
'36': '320x240',
'37': '1920x1080',
'38': '4096x3072',
'43': '640x360',
'44': '854x480',
'45': '1280x720',
'46': '1920x1080',
'82': '360p',
'83': '480p',
'84': '720p',
'85': '1080p',
'92': '240p',
'93': '360p',
'94': '480p',
'95': '720p',
'96': '1080p',
'100': '360p',
'101': '480p',
'102': '720p',
'132': '240p',
'151': '72p',
'133': '240p',
'134': '360p',
'135': '480p',
'136': '720p',
'137': '1080p',
'138': '>1080p',
'139': '48k',
'140': '128k',
'141': '256k',
'160': '192p',
'171': '128k',
'172': '256k',
'242': '240p',
'243': '360p',
'244': '480p',
'245': '480p',
'246': '480p',
'247': '720p',
'248': '1080p',
'5': {'width': 400, 'height': 240},
'6': {},
'13': {},
'17': {'width': 176, 'height': 144},
'18': {'width': 640, 'height': 360},
'22': {'width': 1280, 'height': 720},
'34': {'width': 640, 'height': 360},
'35': {'width': 854, 'height': 480},
'36': {'width': 320, 'height': 240},
'37': {'width': 1920, 'height': 1080},
'38': {'width': 4096, 'height': 3072},
'43': {'width': 640, 'height': 360},
'44': {'width': 854, 'height': 480},
'45': {'width': 1280, 'height': 720},
'46': {'width': 1920, 'height': 1080},
'82': {'height': 360, 'display': '360p'},
'83': {'height': 480, 'display': '480p'},
'84': {'height': 720, 'display': '720p'},
'85': {'height': 1080, 'display': '1080p'},
'92': {'height': 240, 'display': '240p'},
'93': {'height': 360, 'display': '360p'},
'94': {'height': 480, 'display': '480p'},
'95': {'height': 720, 'display': '720p'},
'96': {'height': 1080, 'display': '1080p'},
'100': {'height': 360, 'display': '360p'},
'101': {'height': 480, 'display': '480p'},
'102': {'height': 720, 'display': '720p'},
'132': {'height': 240, 'display': '240p'},
'151': {'height': 72, 'display': '72p'},
'133': {'height': 240, 'display': '240p'},
'134': {'height': 360, 'display': '360p'},
'135': {'height': 480, 'display': '480p'},
'136': {'height': 720, 'display': '720p'},
'137': {'height': 1080, 'display': '1080p'},
'138': {'height': 1081, 'display': '>1080p'},
'139': {'display': '48k'},
'140': {'display': '128k'},
'141': {'display': '256k'},
'160': {'height': 192, 'display': '192p'},
'171': {'display': '128k'},
'172': {'display': '256k'},
'242': {'height': 240, 'display': '240p'},
'243': {'height': 360, 'display': '360p'},
'244': {'height': 480, 'display': '480p'},
'245': {'height': 480, 'display': '480p'},
'246': {'height': 480, 'display': '480p'},
'247': {'height': 720, 'display': '720p'},
'248': {'height': 1080, 'display': '1080p'},
}
_special_itags = {
'82': '3D',
@ -1412,12 +1412,14 @@ def _extract_count(klass):
for itag, video_real_url in video_url_list:
# Extension
video_extension = self._video_extensions.get(itag, 'flv')
resolution = self._video_dimensions.get(itag, {}).get('display')
width = self._video_dimensions.get(itag, {}).get('width')
height = self._video_dimensions.get(itag, {}).get('height')
note = self._special_itags.get(itag)
video_format = '{0} - {1}{2}'.format(itag if itag else video_extension,
self._video_dimensions.get(itag, '???'),
'%dx%d' % (width, height) if width is not None and height is not None else (resolution if resolution is not None else '???'),
' ('+self._special_itags[itag]+')' if itag in self._special_itags else '')
note = self._special_itags.get(itag, None)
resolution = self._video_dimensions.get(itag, None)
formats.append({
'url': video_real_url,
@ -1426,6 +1428,8 @@ def _extract_count(klass):
'format_id': itag,
'player_url': player_url,
'_resolution': resolution,
'width': width,
'height': height,
'format_note': note,
})