1
0
mirror of https://github.com/ytdl-org/youtube-dl synced 2025-12-07 20:13:50 +00:00

Compare commits

..

No commits in common. "956b8c585591b401a543e409accb163eeaaa1193" and "d0283f5385acd21dd51afa2102844c8cb2fe6b62" have entirely different histories.

2 changed files with 54 additions and 48 deletions

View File

@ -2404,52 +2404,60 @@ class YoutubeDL(object):
return res return res
def _format_note(self, fdict): def _format_note(self, fdict):
res = ''
def simplified_codec(f, field): if fdict.get('ext') in ['f4f', 'f4m']:
assert field in ('acodec', 'vcodec') res += '(unsupported) '
codec = f.get(field) if fdict.get('language'):
return ( if res:
'unknown' if not codec res += ' '
else '.'.join(codec.split('.')[:4]) if codec != 'none' res += '[%s] ' % fdict['language']
else 'images' if field == 'vcodec' and f.get('acodec') == 'none' if fdict.get('format_note') is not None:
else None if field == 'acodec' and f.get('vcodec') == 'none' res += fdict['format_note'] + ' '
else 'audio only' if field == 'vcodec' if fdict.get('tbr') is not None:
else 'video only') res += '%4dk ' % fdict['tbr']
res = join_nonempty(
fdict.get('ext') in ('f4f', 'f4m') and '(unsupported)',
fdict.get('language') and ('[%s]' % (fdict['language'],)),
fdict.get('format_note') is not None and fdict['format_note'],
fdict.get('tbr') is not None and ('%4dk' % fdict['tbr']),
delim=' ')
res = [res] if res else []
if fdict.get('container') is not None: if fdict.get('container') is not None:
res.append('%s container' % (fdict['container'],)) if res:
if fdict.get('vcodec') not in (None, 'none'): res += ', '
codec = simplified_codec(fdict, 'vcodec') res += '%s container' % fdict['container']
if codec and fdict.get('vbr') is not None: if (fdict.get('vcodec') is not None
codec += '@' and fdict.get('vcodec') != 'none'):
if res:
res += ', '
res += fdict['vcodec']
if fdict.get('vbr') is not None:
res += '@'
elif fdict.get('vbr') is not None and fdict.get('abr') is not None: elif fdict.get('vbr') is not None and fdict.get('abr') is not None:
codec = 'video@' res += 'video@'
else: if fdict.get('vbr') is not None:
codec = None res += '%4dk' % fdict['vbr']
codec = join_nonempty(codec, fdict.get('vbr') is not None and ('%4dk' % fdict['vbr']))
if codec:
res.append(codec)
if fdict.get('fps') is not None: if fdict.get('fps') is not None:
res.append('%sfps' % (fdict['fps'],)) if res:
codec = ( res += ', '
simplified_codec(fdict, 'acodec') if fdict.get('acodec') is not None res += '%sfps' % fdict['fps']
else 'audio' if fdict.get('abr') is not None else None) if fdict.get('acodec') is not None:
if codec: if res:
res.append(join_nonempty( res += ', '
'%-4s' % (codec + (('@%3dk' % fdict['abr']) if fdict.get('abr') else ''),), if fdict['acodec'] == 'none':
fdict.get('asr') and '(%5dHz)' % fdict['asr'], delim=' ')) res += 'video only'
else:
res += '%-5s' % fdict['acodec']
elif fdict.get('abr') is not None:
if res:
res += ', '
res += 'audio'
if fdict.get('abr') is not None:
res += '@%3dk' % fdict['abr']
if fdict.get('asr') is not None:
res += ' (%5dHz)' % fdict['asr']
if fdict.get('filesize') is not None: if fdict.get('filesize') is not None:
res.append(format_bytes(fdict['filesize'])) if res:
res += ', '
res += format_bytes(fdict['filesize'])
elif fdict.get('filesize_approx') is not None: elif fdict.get('filesize_approx') is not None:
res.append('~' + format_bytes(fdict['filesize_approx'])) if res:
return ', '.join(res) res += ', '
res += '~' + format_bytes(fdict['filesize_approx'])
return res
def list_formats(self, info_dict): def list_formats(self, info_dict):
formats = info_dict.get('formats', [info_dict]) formats = info_dict.get('formats', [info_dict])

View File

@ -1669,12 +1669,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'_rtmp': {'protocol': 'rtmp'}, '_rtmp': {'protocol': 'rtmp'},
# av01 video only formats sometimes served with "unknown" codecs # av01 video only formats sometimes served with "unknown" codecs
'394': {'acodec': 'none', 'vcodec': 'av01.0.00M.08'}, '394': {'acodec': 'none', 'vcodec': 'av01.0.05M.08'},
'395': {'acodec': 'none', 'vcodec': 'av01.0.00M.08'}, '395': {'acodec': 'none', 'vcodec': 'av01.0.05M.08'},
'396': {'acodec': 'none', 'vcodec': 'av01.0.01M.08'}, '396': {'acodec': 'none', 'vcodec': 'av01.0.05M.08'},
'397': {'acodec': 'none', 'vcodec': 'av01.0.04M.08'}, '397': {'acodec': 'none', 'vcodec': 'av01.0.05M.08'},
'398': {'acodec': 'none', 'vcodec': 'av01.0.05M.08'},
'399': {'acodec': 'none', 'vcodec': 'av01.0.08M.08'},
} }
_PLAYER_JS_VARIANT_MAP = ( _PLAYER_JS_VARIANT_MAP = (
@ -3813,7 +3811,7 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
continuation = None continuation = None
for is_renderer in traverse_obj(slr_renderer, ( for is_renderer in traverse_obj(slr_renderer, (
'contents', Ellipsis, 'itemSectionRenderer', T(dict))): 'contents', Ellipsis, 'itemSectionRenderer', T(dict))):
for isr_content in traverse_obj(is_renderer, ( for isr_content in traverse_obj(slr_renderer, (
'contents', Ellipsis, T(dict))): 'contents', Ellipsis, T(dict))):
renderer = isr_content.get('playlistVideoListRenderer') renderer = isr_content.get('playlistVideoListRenderer')
if renderer: if renderer: