feat: implement YouTube downloader UI and integration logic with renderer, CSS, and main process support

This commit is contained in:
Ümit Tunç
2026-05-28 07:09:34 +03:00
parent 723aea5b04
commit 2b303cfc9b
6 changed files with 721 additions and 317 deletions
+6 -4
View File
@@ -206,27 +206,29 @@ function getVideoInfo(url) {
}
// Download video or convert to MP3
function downloadMedia(url, format, outputDir, onProgress) {
console.log(`[DEBUG] Media download requested. Format: ${format}, Target Dir: ${outputDir}`);
function downloadMedia(url, format, quality, outputDir, onProgress) {
console.log(`[DEBUG] Media download requested. Format: ${format}, Quality: ${quality}, Target Dir: ${outputDir}`);
return new Promise((resolve, reject) => {
let args = [];
const outputTemplate = path.join(outputDir, '%(title)s.%(ext)s');
if (format === 'mp3') {
const q = quality ? `${quality}K` : '320K'; // '320K', '256K', '192K'
args = [
'--no-playlist',
'--ffmpeg-location', FFMPEG_PATH,
'-x',
'--audio-format', 'mp3',
'--audio-quality', '320K',
'--audio-quality', q,
'-o', outputTemplate,
url
];
} else {
const res = quality || '1080'; // '1080', '720', '480'
args = [
'--no-playlist',
'--ffmpeg-location', FFMPEG_PATH,
'-f', 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b',
'-f', `bv*[height<=${res}][ext=mp4]+ba[ext=m4a]/b[height<=${res}][ext=mp4] / bv*[height<=${res}]+ba/b[height<=${res}]`,
'-o', outputTemplate,
url
];