diff --git a/index.js b/index.js index 3714b0c..89149ea 100644 --- a/index.js +++ b/index.js @@ -58,11 +58,13 @@ app.get("/getLink", async (req, res) => { var vidinfo = await ytdl.getBasicInfo(url) + res.write(`

Beginning download...

`) + var lastp = 0 var ytvid = ytdl(url, { 'quality': quality, 'format': 'mp4' }) .on("progress", (data, ctotal, etotal) => { - var integer = 1 + var integer = 5 var percent = (Math.ceil(ctotal / etotal * 100)) if (percent % integer == 0 && lastp != percent) { res.write(`

Downloading... ${percent}% (${formatBytes(ctotal)})

`) @@ -82,7 +84,7 @@ app.get("/getLink", async (req, res) => { var proc = new ffmpeg(ytpath) // res.write(`

Converting... (May take a while, doesn't support progress updates yet)

`) var endpath = ('cached/' + ytdl.getVideoID(url) + String(Math.floor(Math.random() * 100000)) + "Converted." + format) - // res.write(`

Converting... 0% (Potentially Innacurate, Experimental!)

`) + res.write(`

Beginning conversion... Conversion may be slow depending on instance.

`) proc.then(function (video) { video .setVideoDuration(vidinfo.videoDetails.lengthSeconds) @@ -110,7 +112,7 @@ app.get("/getLink", async (req, res) => { var count = 0 var integer = 1 - var lastc = -1 + var lastc = 0 var percent = 0 async function update() { if (fs.existsSync(endpath)) {