Fixed naming thingy!
This commit is contained in:
parent
4b4a0b32b5
commit
39bd15e1b5
1 changed files with 12 additions and 1 deletions
13
index.js
13
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 })
|
||||
|
|
Loading…
Reference in a new issue