2023-08-21 11:46:48 -05:00
|
|
|
const ytdl = require('ytdl-core'),
|
|
|
|
fs = require('fs'),
|
|
|
|
path = require('path'),
|
|
|
|
express = require('express'),
|
2023-11-20 14:39:04 -06:00
|
|
|
bodyParser = require('body-parser'),
|
|
|
|
cp = require("child_process"),
|
|
|
|
|
2023-05-05 11:15:22 -05:00
|
|
|
|
|
|
|
const PORT = process.env.PORT || 8080
|
|
|
|
const app = express()
|
2023-10-23 10:57:35 -05:00
|
|
|
|
2023-11-20 14:39:04 -06:00
|
|
|
var formats = {
|
|
|
|
"matroska": "mkv"
|
2023-10-23 10:57:35 -05:00
|
|
|
}
|
|
|
|
|
2023-11-20 14:39:04 -06:00
|
|
|
app.get("/download", async (req, res) => {
|
2023-05-08 12:52:41 -05:00
|
|
|
const url = req.query.url
|
2023-12-09 12:10:50 -06:00
|
|
|
const format = req.query.format || 'mp4'
|
|
|
|
const quality = req.query.quality || 'highest'
|
|
|
|
const defin = req.query.definition || 'hd'
|
|
|
|
const preset = 'medium'
|
2023-05-10 12:36:26 -05:00
|
|
|
|
2023-10-25 22:07:48 -05:00
|
|
|
res.setHeader("X-Accel-Buffering", "no")
|
|
|
|
|
2024-01-07 16:37:37 -06:00
|
|
|
|
2023-11-20 14:39:04 -06:00
|
|
|
|
2023-10-20 18:03:54 -05:00
|
|
|
})
|
2023-05-05 11:15:22 -05:00
|
|
|
|
|
|
|
app.use(express.static(path.join(__dirname, 'static')))
|
|
|
|
|
2023-05-10 12:36:26 -05:00
|
|
|
app.listen(PORT, function () {
|
2023-05-05 11:15:22 -05:00
|
|
|
console.log("Hosted on port " + PORT)
|
|
|
|
})
|