|
|
|
@ -118,11 +118,10 @@ function download(type) {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (videoType === "mp4") {
|
|
|
|
if (videoType === "mp4") {
|
|
|
|
format = `-f "${formatId}+m4a/mp4[height=${quality}]+m4a/bv*[height<=${quality}]+ba/best[height<=${quality}]"`;
|
|
|
|
format = `-f "${formatId}+m4a/mp4[height=${quality}]+m4a/bv*[height<=${quality}]+ba/best[height<=${quality}]"`;
|
|
|
|
}
|
|
|
|
} else if (videoType === "webm") {
|
|
|
|
else if (videoType === "webm"){
|
|
|
|
|
|
|
|
format = `-f "webm[height<=${quality}]+opus/bv*[height<=${quality}]+ba/${formatId}+m4a/mp4[height=${quality}]+m4a/best[height<=${quality}]"`;
|
|
|
|
format = `-f "webm[height<=${quality}]+opus/bv*[height<=${quality}]+ba/${formatId}+m4a/mp4[height=${quality}]+m4a/best[height<=${quality}]"`;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
format = `-f "bv*[height=${quality}]+ba/best[height=${quality}]/best[height<=${quality}]"`
|
|
|
|
format = `-f "bv*[height=${quality}]+ba/best[height=${quality}]/best[height<=${quality}]"`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
@ -152,6 +151,37 @@ function download(type) {
|
|
|
|
{ shell: true, detached: false },
|
|
|
|
{ shell: true, detached: false },
|
|
|
|
controller.signal
|
|
|
|
controller.signal
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// Youtube provides m4a as audio, so no need to convert
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
|
|
(url.includes("youtube.com/") || url.includes("youtu.be/")) &&
|
|
|
|
|
|
|
|
format == "m4a"
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
downloadProcess = ytdlp.exec(
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
"--yes-playlist",
|
|
|
|
|
|
|
|
"--no-warnings",
|
|
|
|
|
|
|
|
"-f",
|
|
|
|
|
|
|
|
`ba[ext=${format}]/ba`,
|
|
|
|
|
|
|
|
"-o",
|
|
|
|
|
|
|
|
`"${path.join(
|
|
|
|
|
|
|
|
downloadDir,
|
|
|
|
|
|
|
|
foldernameFormat,
|
|
|
|
|
|
|
|
filenameFormat
|
|
|
|
|
|
|
|
)}"`,
|
|
|
|
|
|
|
|
"-I",
|
|
|
|
|
|
|
|
`"${playlistIndex}:${playlistEnd}"`,
|
|
|
|
|
|
|
|
"--ffmpeg-location",
|
|
|
|
|
|
|
|
ffmpeg,
|
|
|
|
|
|
|
|
cookieArg,
|
|
|
|
|
|
|
|
browser,
|
|
|
|
|
|
|
|
configArg,
|
|
|
|
|
|
|
|
configTxt,
|
|
|
|
|
|
|
|
`"${url}"`,
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
{ shell: true, detached: false },
|
|
|
|
|
|
|
|
controller.signal
|
|
|
|
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
downloadProcess = ytdlp.exec(
|
|
|
|
downloadProcess = ytdlp.exec(
|
|
|
|
[
|
|
|
|
[
|
|
|
|
@ -161,7 +191,11 @@ function download(type) {
|
|
|
|
"--audio-format",
|
|
|
|
"--audio-format",
|
|
|
|
format,
|
|
|
|
format,
|
|
|
|
"-o",
|
|
|
|
"-o",
|
|
|
|
`"${path.join(downloadDir, foldernameFormat, filenameFormat)}"`,
|
|
|
|
`"${path.join(
|
|
|
|
|
|
|
|
downloadDir,
|
|
|
|
|
|
|
|
foldernameFormat,
|
|
|
|
|
|
|
|
filenameFormat
|
|
|
|
|
|
|
|
)}"`,
|
|
|
|
"-I",
|
|
|
|
"-I",
|
|
|
|
`"${playlistIndex}:${playlistEnd}"`,
|
|
|
|
`"${playlistIndex}:${playlistEnd}"`,
|
|
|
|
"--ffmpeg-location",
|
|
|
|
"--ffmpeg-location",
|
|
|
|
@ -176,6 +210,7 @@ function download(type) {
|
|
|
|
controller.signal
|
|
|
|
controller.signal
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
downloadProcess.on("ytDlpEvent", (eventType, eventData) => {
|
|
|
|
downloadProcess.on("ytDlpEvent", (eventType, eventData) => {
|
|
|
|
// console.log(eventData);
|
|
|
|
// console.log(eventData);
|
|
|
|
@ -509,14 +544,13 @@ audioToggle.addEventListener("click", (event) => {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
getId("select").addEventListener("change", () => {
|
|
|
|
getId("select").addEventListener("change", () => {
|
|
|
|
value = getId("select").value
|
|
|
|
value = getId("select").value;
|
|
|
|
if (value == "best" || value == "worst" || value == "useConfig") {
|
|
|
|
if (value == "best" || value == "worst" || value == "useConfig") {
|
|
|
|
getId("typeSelectBox").style.display = "none"
|
|
|
|
getId("typeSelectBox").style.display = "none";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else {
|
|
|
|
getId("typeSelectBox").style.display = "block";
|
|
|
|
getId("typeSelectBox").style.display = "block"
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// More options
|
|
|
|
// More options
|
|
|
|
|
|
|
|
|
|
|
|
@ -576,7 +610,7 @@ getId("downloadThumbnails").textContent = i18n.__("Download thumbnails");
|
|
|
|
getId("saveLinks").textContent = i18n.__("Save video links to a file");
|
|
|
|
getId("saveLinks").textContent = i18n.__("Save video links to a file");
|
|
|
|
getId("useConfigTxt").textContent = i18n.__("Use config file");
|
|
|
|
getId("useConfigTxt").textContent = i18n.__("Use config file");
|
|
|
|
getId("errorBtn").textContent = i18n.__("Error Details") + " ▼";
|
|
|
|
getId("errorBtn").textContent = i18n.__("Error Details") + " ▼";
|
|
|
|
getId("clText").textContent = i18n.__("Current download location - ")
|
|
|
|
getId("clText").textContent = i18n.__("Current download location - ");
|
|
|
|
getId("selectLocation").textContent = i18n.__("Select Download Location");
|
|
|
|
getId("selectLocation").textContent = i18n.__("Select Download Location");
|
|
|
|
getId("themeTxt").textContent = i18n.__("Theme");
|
|
|
|
getId("themeTxt").textContent = i18n.__("Theme");
|
|
|
|
getId("autoTxt").textContent = i18n.__("Auto");
|
|
|
|
getId("autoTxt").textContent = i18n.__("Auto");
|
|
|
|
|