[extractor/youtube] Bypass throttling for `-f17`

and related cleanup

Thanks @AudricV for the finding

Ref: yt-dlp/yt-dlp/commit/c9abebb
pull/32023/head
pukkandan 2023-03-09 22:09:23 +05:30 committed by dirkf
parent 88f28f620b
commit 3f6d2bd76f
1 changed files with 4 additions and 9 deletions

View File

@ -2052,13 +2052,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
if mobj: if mobj:
dct['ext'] = mimetype2ext(mobj.group(1)) dct['ext'] = mimetype2ext(mobj.group(1))
dct.update(parse_codecs(mobj.group(2))) dct.update(parse_codecs(mobj.group(2)))
no_audio = dct.get('acodec') == 'none' single_stream = 'none' in (dct.get(c) for c in ('acodec', 'vcodec'))
no_video = dct.get('vcodec') == 'none' if single_stream and dct.get('ext'):
if no_audio: dct['container'] = dct['ext'] + '_dash'
dct['vbr'] = tbr if single_stream or itag == '17':
if no_video:
dct['abr'] = tbr
if no_audio or no_video:
# avoid Youtube throttling # avoid Youtube throttling
dct.update({ dct.update({
'protocol': 'http_dash_segments', 'protocol': 'http_dash_segments',
@ -2067,8 +2064,6 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'downloader_options': {'http_chunk_size': CHUNK_SIZE} # No longer useful? 'downloader_options': {'http_chunk_size': CHUNK_SIZE} # No longer useful?
}) })
if dct.get('ext'):
dct['container'] = dct['ext'] + '_dash'
formats.append(dct) formats.append(dct)
hls_manifest_url = streaming_data.get('hlsManifestUrl') hls_manifest_url = streaming_data.get('hlsManifestUrl')