Still not done
This commit is contained in:
parent
184f58a147
commit
78d50b2ca7
3 changed files with 66 additions and 50 deletions
14
index.js
14
index.js
|
@ -9,21 +9,17 @@ const app = express()
|
|||
app.get("/download", (req, res) => {
|
||||
const filename = req.query.filename
|
||||
const url = req.query.url
|
||||
const format= req.query.format
|
||||
const format = req.query.format
|
||||
const quality = req.query.quality
|
||||
|
||||
if ((filename === 'string' && url === 'string' && format === 'string' && quality === 'string')) {
|
||||
res.header('Content-Disposition', `attachment; filename="${filename}.${format}"`);
|
||||
ytdl(url, {'format': format, 'quality': quality}).pipe(res);
|
||||
} else {
|
||||
res.send('Please input proper values in all fields.')
|
||||
}
|
||||
|
||||
res.header('Content-Disposition', `attachment; filename="${filename}.${format}"`);
|
||||
ytdl(url, { 'format': format, 'quality': quality }).pipe(res);
|
||||
|
||||
});
|
||||
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'static')))
|
||||
|
||||
app.listen(PORT, function() {
|
||||
app.listen(PORT, function () {
|
||||
console.log("Hosted on port " + PORT)
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue