I am creating a web application using node js that can download videos from facebook, i am getting the url and quality using express using the code below but how can i download it
const express = require('express');
const app = express();
const path = require('path');
const bodyParser = require('body-parser');
var http = require('http');
var fs = require('fs');
app.get('/', (req,res)=>{
res.sendFile(path.join(__dirname,'templates','index.html'));
});
app.use(bodyParser.urlencoded({ extended: true }));
//app.use(express.bodyParser());
app.post('/send_data', function(req, res) {
res.send('You sent the name "' + req.body.fbUrl + ' in '+req.body.quality+' Quality".');
if(req.body.quality == "HD")
{
download_video("HD");
}
else if(req.body.quality == "SD")
{
download_video("SD");
}
else if(req.body.quality == "MP3")
{
download_video("MP3");
}
else
{
app.get('/', (req,res)=>{
res.sendFile(path.join(__dirname,'templates','index.html'));
});
}
function download_video(quality)
{
console.log('video is downloading in "'+req.body.quality+'" Quality');
}