Fixed naming thingy!

This commit is contained in:
Violet 2023-10-25 20:53:18 -05:00
parent 4b4a0b32b5
commit 39bd15e1b5

View file

@ -11,6 +11,8 @@ if (fs.existsSync(path.join(__dirname, 'cached'))) {
fs.rmSync(path.join(__dirname, 'cached'), { recursive: true, force: true }) fs.rmSync(path.join(__dirname, 'cached'), { recursive: true, force: true })
} }
const characters = "abcdefghijklmnopqrstuvwxyz!@#$%^*()[]_-=+"
function formatBytes(bytes, decimals = 2) { function formatBytes(bytes, decimals = 2) {
if (!+bytes) return '0 Bytes' if (!+bytes) return '0 Bytes'
@ -52,7 +54,16 @@ app.get("/getLink", async (req, res) => {
var vidinfo = await ytdl.getBasicInfo(url) 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)) { if (["mp4", "webm"].includes(format)) {
var ytvid = ytdl(url, { 'quality': quality, 'format': format }) var ytvid = ytdl(url, { 'quality': quality, 'format': format })