diff options
author | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-08-15 13:42:23 +0530 |
---|---|---|
committer | pukkandan <pukkandan.ytdlp@gmail.com> | 2021-08-17 04:29:56 +0530 |
commit | 8f18aca8717bb0dd49054555af8d386e5eda3a88 (patch) | |
tree | d152c00de20766b03d001f60d4bffc45a3e5ea16 /yt_dlp/YoutubeDL.py | |
parent | 3ad56b42360bd73c1c9c68dbd1d65d1ca492d676 (diff) | |
download | hypervideo-pre-8f18aca8717bb0dd49054555af8d386e5eda3a88.tar.lz hypervideo-pre-8f18aca8717bb0dd49054555af8d386e5eda3a88.tar.xz hypervideo-pre-8f18aca8717bb0dd49054555af8d386e5eda3a88.zip |
Let `--match-filter` reject entries early
Makes redundant: `--match-title`, `--reject-title`, `--min-views`, `--max-views`
Diffstat (limited to 'yt_dlp/YoutubeDL.py')
-rw-r--r-- | yt_dlp/YoutubeDL.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index d12131acd..eef3f8b4c 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -1117,12 +1117,15 @@ class YoutubeDL(object): if age_restricted(info_dict.get('age_limit'), self.params.get('age_limit')): return 'Skipping "%s" because it is age restricted' % video_title - if not incomplete: - match_filter = self.params.get('match_filter') - if match_filter is not None: - ret = match_filter(info_dict) - if ret is not None: - return ret + match_filter = self.params.get('match_filter') + if match_filter is not None: + try: + ret = match_filter(info_dict, incomplete=incomplete) + except TypeError: + # For backward compatibility + ret = None if incomplete else match_filter(info_dict) + if ret is not None: + return ret return None if self.in_download_archive(info_dict): @@ -2873,13 +2876,13 @@ class YoutubeDL(object): except UnavailableVideoError: self.report_error('unable to download video') except MaxDownloadsReached: - self.to_screen('[info] Maximum number of downloaded files reached') + self.to_screen('[info] Maximum number of downloads reached') raise except ExistingVideoReached: - self.to_screen('[info] Encountered a file that is already in the archive, stopping due to --break-on-existing') + self.to_screen('[info] Encountered a video that is already in the archive, stopping due to --break-on-existing') raise except RejectedVideoReached: - self.to_screen('[info] Encountered a file that did not match filter, stopping due to --break-on-reject') + self.to_screen('[info] Encountered a video that did not match filter, stopping due to --break-on-reject') raise else: if self.params.get('dump_single_json', False): |