Skip to content

Commit

Permalink
Added mp3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Moorad committed Oct 18, 2019
1 parent cb7b33c commit 3800c1d
Show file tree
Hide file tree
Showing 6 changed files with 445 additions and 394 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
15 changes: 12 additions & 3 deletions Server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ app.listen(4000, () => {
console.log('Server Works !!! At port 4000');
});

app.get('/download', (req,res) => {
var URL = req.query.URL;
app.get('/downloadmp3', (req,res) => {
var url = req.query.url;
res.header('Content-Disposition', 'attachment; filename="audio.mp3"');
ytdl(url, {
format: 'mp3',
filter: 'audioonly'
}).pipe(res);
});

app.get('/downloadmp4', (req,res) => {
var url = req.query.url;
res.header('Content-Disposition', 'attachment; filename="video.mp4"');
ytdl(URL, {
ytdl(url, {
format: 'mp4'
}).pipe(res);
});
Loading

0 comments on commit 3800c1d

Please sign in to comment.