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 })