mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[YoutubeIE] Add width and height to format dict
This commit is contained in:
parent
4ea3be0a5c
commit
dbd1988ed9
1 changed files with 55 additions and 51 deletions
|
@ -219,54 +219,54 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
|
||||||
'248': 'webm',
|
'248': 'webm',
|
||||||
}
|
}
|
||||||
_video_dimensions = {
|
_video_dimensions = {
|
||||||
'5': '400x240',
|
'5': {'width': 400, 'height': 240},
|
||||||
'6': '???',
|
'6': {},
|
||||||
'13': '???',
|
'13': {},
|
||||||
'17': '176x144',
|
'17': {'width': 176, 'height': 144},
|
||||||
'18': '640x360',
|
'18': {'width': 640, 'height': 360},
|
||||||
'22': '1280x720',
|
'22': {'width': 1280, 'height': 720},
|
||||||
'34': '640x360',
|
'34': {'width': 640, 'height': 360},
|
||||||
'35': '854x480',
|
'35': {'width': 854, 'height': 480},
|
||||||
'36': '320x240',
|
'36': {'width': 320, 'height': 240},
|
||||||
'37': '1920x1080',
|
'37': {'width': 1920, 'height': 1080},
|
||||||
'38': '4096x3072',
|
'38': {'width': 4096, 'height': 3072},
|
||||||
'43': '640x360',
|
'43': {'width': 640, 'height': 360},
|
||||||
'44': '854x480',
|
'44': {'width': 854, 'height': 480},
|
||||||
'45': '1280x720',
|
'45': {'width': 1280, 'height': 720},
|
||||||
'46': '1920x1080',
|
'46': {'width': 1920, 'height': 1080},
|
||||||
'82': '360p',
|
'82': {'height': 360, 'display': '360p'},
|
||||||
'83': '480p',
|
'83': {'height': 480, 'display': '480p'},
|
||||||
'84': '720p',
|
'84': {'height': 720, 'display': '720p'},
|
||||||
'85': '1080p',
|
'85': {'height': 1080, 'display': '1080p'},
|
||||||
'92': '240p',
|
'92': {'height': 240, 'display': '240p'},
|
||||||
'93': '360p',
|
'93': {'height': 360, 'display': '360p'},
|
||||||
'94': '480p',
|
'94': {'height': 480, 'display': '480p'},
|
||||||
'95': '720p',
|
'95': {'height': 720, 'display': '720p'},
|
||||||
'96': '1080p',
|
'96': {'height': 1080, 'display': '1080p'},
|
||||||
'100': '360p',
|
'100': {'height': 360, 'display': '360p'},
|
||||||
'101': '480p',
|
'101': {'height': 480, 'display': '480p'},
|
||||||
'102': '720p',
|
'102': {'height': 720, 'display': '720p'},
|
||||||
'132': '240p',
|
'132': {'height': 240, 'display': '240p'},
|
||||||
'151': '72p',
|
'151': {'height': 72, 'display': '72p'},
|
||||||
'133': '240p',
|
'133': {'height': 240, 'display': '240p'},
|
||||||
'134': '360p',
|
'134': {'height': 360, 'display': '360p'},
|
||||||
'135': '480p',
|
'135': {'height': 480, 'display': '480p'},
|
||||||
'136': '720p',
|
'136': {'height': 720, 'display': '720p'},
|
||||||
'137': '1080p',
|
'137': {'height': 1080, 'display': '1080p'},
|
||||||
'138': '>1080p',
|
'138': {'height': 1081, 'display': '>1080p'},
|
||||||
'139': '48k',
|
'139': {'display': '48k'},
|
||||||
'140': '128k',
|
'140': {'display': '128k'},
|
||||||
'141': '256k',
|
'141': {'display': '256k'},
|
||||||
'160': '192p',
|
'160': {'height': 192, 'display': '192p'},
|
||||||
'171': '128k',
|
'171': {'display': '128k'},
|
||||||
'172': '256k',
|
'172': {'display': '256k'},
|
||||||
'242': '240p',
|
'242': {'height': 240, 'display': '240p'},
|
||||||
'243': '360p',
|
'243': {'height': 360, 'display': '360p'},
|
||||||
'244': '480p',
|
'244': {'height': 480, 'display': '480p'},
|
||||||
'245': '480p',
|
'245': {'height': 480, 'display': '480p'},
|
||||||
'246': '480p',
|
'246': {'height': 480, 'display': '480p'},
|
||||||
'247': '720p',
|
'247': {'height': 720, 'display': '720p'},
|
||||||
'248': '1080p',
|
'248': {'height': 1080, 'display': '1080p'},
|
||||||
}
|
}
|
||||||
_special_itags = {
|
_special_itags = {
|
||||||
'82': '3D',
|
'82': '3D',
|
||||||
|
@ -1412,12 +1412,14 @@ def _extract_count(klass):
|
||||||
for itag, video_real_url in video_url_list:
|
for itag, video_real_url in video_url_list:
|
||||||
# Extension
|
# Extension
|
||||||
video_extension = self._video_extensions.get(itag, 'flv')
|
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,
|
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 '')
|
' ('+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({
|
formats.append({
|
||||||
'url': video_real_url,
|
'url': video_real_url,
|
||||||
|
@ -1426,6 +1428,8 @@ def _extract_count(klass):
|
||||||
'format_id': itag,
|
'format_id': itag,
|
||||||
'player_url': player_url,
|
'player_url': player_url,
|
||||||
'_resolution': resolution,
|
'_resolution': resolution,
|
||||||
|
'width': width,
|
||||||
|
'height': height,
|
||||||
'format_note': note,
|
'format_note': note,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue