diff --git a/downloader.js b/downloader.js index 70a3f04..a1550ba 100644 --- a/downloader.js +++ b/downloader.js @@ -31,7 +31,10 @@ expressManager.app.get("/download", async (req, res) => { var info = await ytdl.getInfo(url) - res.setHeader("Content-Disposition", `attachment; filename="${info.videoDetails.title.replace(/[^a-z0-9 ]/gi, '')}.${format}"`) + var downloadType = "attachment" + if (req.query.playInBrowser) downloadType = "inline"; + + res.setHeader("Content-Disposition", `${downloadType}; filename="${info.videoDetails.title.replace(/[^a-z0-9 ]/gi, '')}.${format}"`) var audioFormat = ytdl.chooseFormat(info.formats, { filter: (format) => { return format.hasAudio && !format.hasVideo diff --git a/static/index.html b/static/index.html index ef5c825..f4a21e3 100644 --- a/static/index.html +++ b/static/index.html @@ -61,6 +61,10 @@ +
+ +

Play in browser

+