From 39bd15e1b53d8b5917ffdb337965392ff966d2e3 Mon Sep 17 00:00:00 2001 From: Violet Date: Wed, 25 Oct 2023 20:53:18 -0500 Subject: [PATCH] Fixed naming thingy! --- index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c10d134..c0411a0 100644 --- a/index.js +++ b/index.js @@ -11,6 +11,8 @@ if (fs.existsSync(path.join(__dirname, 'cached'))) { fs.rmSync(path.join(__dirname, 'cached'), { recursive: true, force: true }) } +const characters = "abcdefghijklmnopqrstuvwxyz!@#$%^*()[]_-=+" + function formatBytes(bytes, decimals = 2) { if (!+bytes) return '0 Bytes' @@ -52,7 +54,16 @@ app.get("/getLink", async (req, res) => { var vidinfo = await ytdl.getBasicInfo(url) - const filename = vidinfo.videoDetails.title + const ogname = vidinfo.videoDetails.title + var filename = "" + + for (let index = 0; index < ogname.length; index++) { + const letter = ogname[index]; + if ((characters + characters.toUpperCase()).includes(letter)) { + filename += letter + } + + } if (["mp4", "webm"].includes(format)) { var ytvid = ytdl(url, { 'quality': quality, 'format': format })