diff --git a/backend/app.js b/backend/app.js index 823ea46..d2c4378 100644 --- a/backend/app.js +++ b/backend/app.js @@ -1505,6 +1505,10 @@ async function generateArgs(url, type, options) { } } + + // filter out incompatible args + downloadConfig = filterArgs(downloadConfig, is_audio); + logger.verbose(`youtube-dl args being used: ${downloadConfig.join(',')}`); return downloadConfig; } @@ -1535,6 +1539,13 @@ async function getVideoInfoByURL(url, args = [], download = null) { }); } +function filterArgs(args, isAudio) { + const video_only_args = ['--add-metadata', '--embed-subs', '--xattrs']; + const audio_only_args = ['-x', '--extract-audio', '--embed-thumbnail']; + const args_to_remove = isAudio ? video_only_args : audio_only_args; + return args.filter(x => !args_to_remove.includes(x)); +} + // currently only works for single urls async function getUrlInfos(urls) { let startDate = Date.now();