NO MORE FILENAME OPTION!
This commit is contained in:
parent
87dd6ea117
commit
db38f8c4d6
2 changed files with 8 additions and 8 deletions
12
index.js
12
index.js
|
@ -38,7 +38,6 @@ process.on('uncaughtException', (err, origin) => {
|
||||||
app.use(bodyParser.urlencoded({ extended: false }))
|
app.use(bodyParser.urlencoded({ extended: false }))
|
||||||
|
|
||||||
app.get("/getLink", async (req, res) => {
|
app.get("/getLink", async (req, res) => {
|
||||||
const filename = req.query.filename
|
|
||||||
const url = req.query.url
|
const url = req.query.url
|
||||||
const format = req.query.format
|
const format = req.query.format
|
||||||
const quality = req.query.quality
|
const quality = req.query.quality
|
||||||
|
@ -50,6 +49,11 @@ app.get("/getLink", async (req, res) => {
|
||||||
res.write(`<p>Invalid URL! Check the url for any errors! <br>URL: ${url}</p>`)
|
res.write(`<p>Invalid URL! Check the url for any errors! <br>URL: ${url}</p>`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var vidinfo = await ytdl.getBasicInfo(url)
|
||||||
|
|
||||||
|
const filename = vidinfo.videoDetails.title
|
||||||
|
|
||||||
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 })
|
||||||
var debounce = false
|
var debounce = false
|
||||||
|
@ -80,8 +84,6 @@ app.get("/getLink", async (req, res) => {
|
||||||
// String(Math.floor(Math.random() * 100000)) +
|
// String(Math.floor(Math.random() * 100000)) +
|
||||||
var ytpath = path.join(__dirname, 'cached/' + ytdl.getVideoID(url) + '.mp4')
|
var ytpath = path.join(__dirname, 'cached/' + ytdl.getVideoID(url) + '.mp4')
|
||||||
|
|
||||||
var vidinfo = await ytdl.getBasicInfo(url)
|
|
||||||
|
|
||||||
if (redir != "redirect") {
|
if (redir != "redirect") {
|
||||||
res.write(`<p>Starting download...</p>`)
|
res.write(`<p>Starting download...</p>`)
|
||||||
}
|
}
|
||||||
|
@ -112,11 +114,9 @@ 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() * 10000000)) + "Converted." + format)
|
||||||
if (redir != "redirect") {
|
if (redir != "redirect") {
|
||||||
res.write(`<p>Starting Video Conversion... Conversion may be slow depending on instance.</p>`)
|
res.write(`<p>Starting Video Conversion... Conversion may be slow depending on instance.</p>`)
|
||||||
} else {
|
|
||||||
console.log(redir)
|
|
||||||
}
|
}
|
||||||
proc.then(function (video) {
|
proc.then(function (video) {
|
||||||
video
|
video
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
<option value="lowest">Lowest</option>
|
<option value="lowest">Lowest</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="setting">
|
<!-- <div class="setting">
|
||||||
<p>Filename:</p>
|
<p>Filename:</p>
|
||||||
<input required id="filename" placeholder="Enter filename" name="filename">
|
<input required id="filename" placeholder="Enter filename" name="filename">
|
||||||
</div>
|
</div> -->
|
||||||
<div class="setting">
|
<div class="setting">
|
||||||
<p>Format:</p>
|
<p>Format:</p>
|
||||||
<select required id="format" name="format">
|
<select required id="format" name="format">
|
||||||
|
|
Loading…
Reference in a new issue