diff --git a/index.js b/index.js index 2e8bd5f..1ba0307 100644 --- a/index.js +++ b/index.js @@ -3,22 +3,11 @@ const ytdl = require('ytdl-core'), path = require('path'), express = require('express'), ffmpeg = require('fluent-ffmpeg'), - bodyParser = require('body-parser'), - multer = require('multer') + bodyParser = require('body-parser') const PORT = process.env.PORT || 8080 const app = express() -const storage = multer.diskStorage({ - destination: function (req, file, cb) { - cb(null, 'uploads/') - }, - filename: function (req, file, cb) { - const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1E9) - cb(null, file.fieldname + '-' + uniqueSuffix + '-' + file.originalname) - } -}) - app.use(bodyParser.urlencoded({ extended: false })) var jsonParser = bodyParser.json() @@ -43,26 +32,6 @@ app.get("/download", (req, res) => { }); -const upload = multer({ limits: { fieldSize: 100_000_000 }, storage: storage }) - -app.post("/convert", upload.single('video'), (req, res) => { - console.log(req.file.path) - const filename = req.body.filename - const vid = req.file.path - const format = req.body.format - - var proc = new ffmpeg({ source: vid }) - .format(format) - .pipe(res) - .on("end", () => { - console.log("AAAA") - fs.unlinkSync(req.file.path) - }) - - res.header('Content-Disposition', `attachment; filename="${filename}.${format}"`); -}); - - app.use(express.static(path.join(__dirname, 'static'))) app.listen(PORT, function () { diff --git a/static/converter/index.html b/static/converter/index.html deleted file mode 100644 index 338f300..0000000 --- a/static/converter/index.html +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - Video Converter - - - -

Video Converter

v0.3

-
-

- -
-

File:

- -

Filename:

-
-

Format:

- - -
-
- -

Please consider hosting the project yourself! (Check github for more details)

-

Check out the Github page to - learn how to host it yourself, how it works, report bugs, and more.

- - - \ No newline at end of file