From 9a6cf946a6e8be35aca45b2a9a97797fc400b094 Mon Sep 17 00:00:00 2001 From: Violet <110205356+Violets-puragtory@users.noreply.github.com> Date: Thu, 26 Oct 2023 13:31:51 +0000 Subject: [PATCH] No longer downloads video for audio formats --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 18681ae..5fe3a30 100644 --- a/index.js +++ b/index.js @@ -101,7 +101,11 @@ app.get("/getLink", async (req, res) => { res.write(`

Starting download...

`) } var lastp = 0 - var ytvid = ytdl(url, { 'quality': quality, 'format': 'mp4' }) + if ("mp3 ogg wav".includes(format)) { + var ytvid = ytdl(url, { 'quality': quality, 'format': 'mp4', filter: "audioonly" }) + } else { + var ytvid = ytdl(url, { 'quality': quality, 'format': 'mp4', filter: "videoandaudio" }) + } if (redir != "redirect") { ytvid.on("progress", (data, ctotal, etotal) => {