Make early reject of `--match-filter` stricter

Closes #5509
pull/1791/merge
pukkandan 2 years ago
parent 171a31dbe8
commit d7b460d0e5
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39

@ -1358,10 +1358,18 @@ class YoutubeDL:
def _match_entry(self, info_dict, incomplete=False, silent=False): def _match_entry(self, info_dict, incomplete=False, silent=False):
""" Returns None if the file should be downloaded """ """ Returns None if the file should be downloaded """
_type = info_dict.get('_type', 'video')
assert incomplete or _type == 'video', 'Only video result can be considered complete'
video_title = info_dict.get('title', info_dict.get('id', 'entry')) video_title = info_dict.get('title', info_dict.get('id', 'entry'))
def check_filter(): def check_filter():
if _type in ('playlist', 'multi_video'):
return
elif _type in ('url', 'url_transparent') and not try_call(
lambda: self.get_info_extractor(info_dict['ie_key']).is_single_video(info_dict['url'])):
return
if 'title' in info_dict: if 'title' in info_dict:
# This can happen when we're just evaluating the playlist # This can happen when we're just evaluating the playlist
title = info_dict['title'] title = info_dict['title']

Loading…
Cancel
Save