diff --git a/backend/app.js b/backend/app.js index 0a5b8b39..690edbc4 100644 --- a/backend/app.js +++ b/backend/app.js @@ -533,12 +533,6 @@ app.post('/api/tomp3', function(req, res) { if (customArgs) { downloadConfig = customArgs.split(' '); } else { - if (customOutput) { - downloadConfig = ['-o', audioFolderPath + customOutput + '.mp3', '-x', '--audio-format', 'mp3', '--write-info-json', '--print-json']; - } else { - downloadConfig = ['-o', audioFolderPath + audiopath + ".mp3", '-x', '--audio-format', 'mp3', '--write-info-json', '--print-json']; - } - if (customQualityConfiguration) { qualityPath = `-f ${customQualityConfiguration}`; } else if (maxBitrate) { @@ -546,6 +540,12 @@ app.post('/api/tomp3', function(req, res) { qualityPath = `--audio-quality ${maxBitrate}` } + if (customOutput) { + downloadConfig = ['-o', audioFolderPath + customOutput + '.mp3', '-x', '--audio-format', 'mp3', '--write-info-json', '--print-json']; + } else { + downloadConfig = ['-o', audioFolderPath + audiopath + ".mp3", '-x', '--audio-format', 'mp3', '--write-info-json', '--print-json']; + } + if (youtubeUsername && youtubePassword) { downloadConfig.push('--username', youtubeUsername, '--password', youtubePassword); } @@ -621,18 +621,18 @@ app.post('/api/tomp4', function(req, res) { if (customArgs) { downloadConfig = customArgs.split(' '); } else { - if (customOutput) { - downloadConfig = ['-o', path + customOutput + ".mp4", '-f', qualityPath, '--write-info-json', '--print-json']; - } else { - downloadConfig = ['-o', path + videopath + ".mp4", '-f', qualityPath, '--write-info-json', '--print-json']; - } - if (customQualityConfiguration) { qualityPath = customQualityConfiguration; } else if (selectedHeight && selectedHeight !== '') { qualityPath = `bestvideo[height=${selectedHeight}]+bestaudio/best[height=${selectedHeight}]`; } + if (customOutput) { + downloadConfig = ['-o', path + customOutput + ".mp4", '-f', qualityPath, '--write-info-json', '--print-json']; + } else { + downloadConfig = ['-o', path + videopath + ".mp4", '-f', qualityPath, '--write-info-json', '--print-json']; + } + if (youtubeUsername && youtubePassword) { downloadConfig.push('--username', youtubeUsername, '--password', youtubePassword); }