Skip to content

Commit

Permalink
Ignore --external-downloader-args if --external-downloader was rejected
Browse files Browse the repository at this point in the history
... and generate warning
  • Loading branch information
dirkf committed Jun 27, 2022
1 parent b088574 commit c9f44c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion youtube_dl/YoutubeDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -1906,8 +1906,17 @@ def ensure_dir_exists(path):

if not self.params.get('skip_download', False):
try:
def checked_get_suitable_downloader(info_dict, params):
ed_args = params.get('external_downloader_args')
dler = get_suitable_downloader(info_dict, params)
if ed_args and not params.get('external_downloader_args'):
# external_downloader_args was cleared because external_downloader was rejected
self.report_warning('Requested external downloader cannot be used: '
'ignoring --external-downloader-args.')
return dler

def dl(name, info):
fd = get_suitable_downloader(info, self.params)(self, self.params)
fd = checked_get_suitable_downloader(info, self.params)(self, self.params)
for ph in self._progress_hooks:
fd.add_progress_hook(ph)
if self.params.get('verbose'):
Expand Down
3 changes: 3 additions & 0 deletions youtube_dl/downloader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def _get_suitable_downloader(info_dict, params={}):
ed = get_external_downloader(external_downloader)
if ed.can_download(info_dict):
return ed
# Avoid using unwanted args since external_downloader was rejected
if params.get('external_downloader_args'):
params['external_downloader_args'] = None

protocol = info_dict['protocol']
if protocol.startswith('m3u8') and info_dict.get('is_live'):
Expand Down

0 comments on commit c9f44c8

Please sign in to comment.