fix mp3s
This commit is contained in:
parent
4f88beab0a
commit
716777f1f5
1 changed files with 5 additions and 2 deletions
|
@ -38,7 +38,7 @@ expressManager.app.get("/download", async (req, res) => {
|
|||
format = req.query.format,
|
||||
trimAudio = req.query.trimAudio && audioFormats.includes(format) || false
|
||||
|
||||
if (req.query.playInBrowser) {
|
||||
if (req.query.playInBrowser && !audioFormats.includes(format)) {
|
||||
var metadata = req.url.substring(req.url.indexOf("?"))
|
||||
res.redirect("/watch" + metadata)
|
||||
} else if (ytdl.validateURL(url) && qualityLabels.includes(quality)) {
|
||||
|
@ -46,7 +46,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
|
||||
|
|
Loading…
Reference in a new issue