cant spell
This commit is contained in:
parent
f0f9edf072
commit
675c55bb1b
1 changed files with 4 additions and 4 deletions
8
index.js
8
index.js
|
@ -58,13 +58,13 @@ app.get("/getLink", async (req, res) => {
|
||||||
|
|
||||||
var vidinfo = await ytdl.getBasicInfo(url)
|
var vidinfo = await ytdl.getBasicInfo(url)
|
||||||
|
|
||||||
res.write(`<p>Beginning download...</p>`)
|
res.write(`<p>Starting download...</p>`)
|
||||||
|
|
||||||
var lastp = 0
|
var lastp = 0
|
||||||
var ytvid = ytdl(url, { 'quality': quality, 'format': 'mp4' })
|
var ytvid = ytdl(url, { 'quality': quality, 'format': 'mp4' })
|
||||||
|
|
||||||
.on("progress", (data, ctotal, etotal) => {
|
.on("progress", (data, ctotal, etotal) => {
|
||||||
var integer = 5
|
var integer = 1
|
||||||
var percent = (Math.ceil(ctotal / etotal * 100))
|
var percent = (Math.ceil(ctotal / etotal * 100))
|
||||||
if (percent % integer == 0 && lastp != percent) {
|
if (percent % integer == 0 && lastp != percent) {
|
||||||
res.write(`<p class="percent" id="percent${percent}">Downloading... ${percent}% (${formatBytes(ctotal)})</p>`)
|
res.write(`<p class="percent" id="percent${percent}">Downloading... ${percent}% (${formatBytes(ctotal)})</p>`)
|
||||||
|
@ -84,7 +84,7 @@ app.get("/getLink", async (req, res) => {
|
||||||
var proc = new ffmpeg(ytpath)
|
var proc = new ffmpeg(ytpath)
|
||||||
// res.write(`<p>Converting... (May take a while, <a href="https://github.com/Violets-puragtory/NoJS-YTConverter"> doesn't support progress updates yet</a>)</p>`)
|
// res.write(`<p>Converting... (May take a while, <a href="https://github.com/Violets-puragtory/NoJS-YTConverter"> doesn't support progress updates yet</a>)</p>`)
|
||||||
var endpath = ('cached/' + ytdl.getVideoID(url) + String(Math.floor(Math.random() * 100000)) + "Converted." + format)
|
var endpath = ('cached/' + ytdl.getVideoID(url) + String(Math.floor(Math.random() * 100000)) + "Converted." + format)
|
||||||
res.write(`<p>Beginning conversion... Conversion may be slow depending on instance.</p>`)
|
res.write(`<p>Starting Video Conversion... Conversion may be slow depending on instance.</p>`)
|
||||||
proc.then(function (video) {
|
proc.then(function (video) {
|
||||||
video
|
video
|
||||||
.setVideoDuration(vidinfo.videoDetails.lengthSeconds)
|
.setVideoDuration(vidinfo.videoDetails.lengthSeconds)
|
||||||
|
@ -136,7 +136,7 @@ app.get("/getLink", async (req, res) => {
|
||||||
if (percent < 100) {
|
if (percent < 100) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
update()
|
update()
|
||||||
}, 1500);
|
}, 2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
update()
|
update()
|
||||||
|
|
Loading…
Reference in a new issue