1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2026-01-28 01:32:19 +00:00

Fix interactive format/video selection when downloading to stdout (#15626)

Authored by: grqz
This commit is contained in:
N/Ame
2026-01-28 14:11:19 +13:00
committed by GitHub
parent 1c739bf53e
commit 1829a53a54

View File

@@ -1602,8 +1602,10 @@ class YoutubeDL:
if ret is NO_DEFAULT:
while True:
filename = self._format_screen(self.prepare_filename(info_dict), self.Styles.FILENAME)
reply = input(self._format_screen(
f'Download "{filename}"? (Y/n): ', self.Styles.EMPHASIS)).lower().strip()
self.to_screen(
self._format_screen(f'Download "{filename}"? (Y/n): ', self.Styles.EMPHASIS),
skip_eol=True)
reply = input().lower().strip()
if reply in {'y', ''}:
return None
elif reply == 'n':
@@ -3030,9 +3032,10 @@ class YoutubeDL:
# Bypass interactive format selection if no formats & --ignore-no-formats-error
formats_to_download = None
break
req_format = input(self._format_screen('\nEnter format selector ', self.Styles.EMPHASIS)
+ '(Press ENTER for default, or Ctrl+C to quit)'
+ self._format_screen(': ', self.Styles.EMPHASIS))
self.to_screen(self._format_screen('\nEnter format selector ', self.Styles.EMPHASIS)
+ '(Press ENTER for default, or Ctrl+C to quit)'
+ self._format_screen(': ', self.Styles.EMPHASIS), skip_eol=True)
req_format = input()
try:
format_selector = self.build_format_selector(req_format) if req_format else None
except SyntaxError as err: