mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-14 19:21:28 +03:00
Args incompatible with video mode and audio-only mode will now get removed
This commit is contained in:
@@ -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(',')}`);
|
logger.verbose(`youtube-dl args being used: ${downloadConfig.join(',')}`);
|
||||||
return downloadConfig;
|
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
|
// currently only works for single urls
|
||||||
async function getUrlInfos(urls) {
|
async function getUrlInfos(urls) {
|
||||||
let startDate = Date.now();
|
let startDate = Date.now();
|
||||||
|
|||||||
Reference in New Issue
Block a user