diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-04-28 20:03:26 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2022-04-28 20:04:40 +0530 |
commit | 492272fed630e3cd4e7649afc03f4084e58df174 (patch) | |
tree | 8015ab3201a8eade827d8eb52312d7ce5696277f /yt_dlp/YoutubeDL.py | |
parent | 59f943cd5097e9bdbc3cb3e6b5675e43d369341a (diff) | |
download | hypervideo-pre-492272fed630e3cd4e7649afc03f4084e58df174.tar.lz hypervideo-pre-492272fed630e3cd4e7649afc03f4084e58df174.tar.xz hypervideo-pre-492272fed630e3cd4e7649afc03f4084e58df174.zip |
`--match-filter -` to interactively ask for each video
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r-- | yt_dlp/YoutubeDL.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index 4351699b6..78345f87a 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -413,6 +413,8 @@ class YoutubeDL: every video. If it returns a message, the video is ignored. If it returns None, the video is downloaded. + If it returns utils.NO_DEFAULT, the user is interactively + asked whether to download the video. match_filter_func in utils.py is one example for this. no_color: Do not emit color codes in output. geo_bypass: Bypass geographic restriction via faking X-Forwarded-For @@ -878,6 +880,7 @@ class YoutubeDL: Styles = Namespace( HEADERS='yellow', EMPHASIS='light blue', + FILENAME='green', ID='green', DELIM='blue', ERROR='red', @@ -1303,7 +1306,17 @@ class YoutubeDL: except TypeError: # For backward compatibility ret = None if incomplete else match_filter(info_dict) - if ret is not None: + 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() + if reply in {'y', ''}: + return None + elif reply == 'n': + return f'Skipping {video_title}' + return True + elif ret is not None: return ret return None |