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.get("/getLink", async (req, res) => {
|
||||
const filename = req.query.filename
|
||||
const url = req.query.url
|
||||
const format = req.query.format
|
||||
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>`)
|
||||
return
|
||||
}
|
||||
|
||||
var vidinfo = await ytdl.getBasicInfo(url)
|
||||
|
||||
const filename = vidinfo.videoDetails.title
|
||||
|
||||
if (["mp4", "webm"].includes(format)) {
|
||||
var ytvid = ytdl(url, { 'quality': quality, 'format': format })
|
||||
var debounce = false
|
||||
|
@ -80,8 +84,6 @@ app.get("/getLink", async (req, res) => {
|
|||
// String(Math.floor(Math.random() * 100000)) +
|
||||
var ytpath = path.join(__dirname, 'cached/' + ytdl.getVideoID(url) + '.mp4')
|
||||
|
||||
var vidinfo = await ytdl.getBasicInfo(url)
|
||||
|
||||
if (redir != "redirect") {
|
||||
res.write(`<p>Starting download...</p>`)
|
||||
}
|
||||
|
@ -112,11 +114,9 @@ app.get("/getLink", async (req, res) => {
|
|||
}
|
||||
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>`)
|
||||
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") {
|
||||
res.write(`<p>Starting Video Conversion... Conversion may be slow depending on instance.</p>`)
|
||||
} else {
|
||||
console.log(redir)
|
||||
}
|
||||
proc.then(function (video) {
|
||||
video
|
||||
|
|
|
@ -29,10 +29,10 @@
|
|||
<option value="lowest">Lowest</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="setting">
|
||||
<!-- <div class="setting">
|
||||
<p>Filename:</p>
|
||||
<input required id="filename" placeholder="Enter filename" name="filename">
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="setting">
|
||||
<p>Format:</p>
|
||||
<select required id="format" name="format">
|
||||
|
|
Loading…
Reference in a new issue