New option to play videos in browser
This commit is contained in:
parent
a688a6293f
commit
a949591f99
2 changed files with 8 additions and 1 deletions
|
@ -31,7 +31,10 @@ expressManager.app.get("/download", async (req, res) => {
|
||||||
|
|
||||||
var info = await ytdl.getInfo(url)
|
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) => {
|
var audioFormat = ytdl.chooseFormat(info.formats, { filter: (format) => {
|
||||||
return format.hasAudio && !format.hasVideo
|
return format.hasAudio && !format.hasVideo
|
||||||
|
|
|
@ -61,6 +61,10 @@
|
||||||
<!-- <input style="display: inline-block" type="checkbox" id="trim" checked>
|
<!-- <input style="display: inline-block" type="checkbox" id="trim" checked>
|
||||||
<p style="display: inline-block" for="trim">Trim BALLS (mp4 only)</p> -->
|
<p style="display: inline-block" for="trim">Trim BALLS (mp4 only)</p> -->
|
||||||
</div>
|
</div>
|
||||||
|
<div id="either">
|
||||||
|
<input style="display: inline-block" type="checkbox" id="playInBrowers" name="playInBrowser">
|
||||||
|
<p style="display: inline-block" for="trim">Play in browser</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<input type="submit">
|
<input type="submit">
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue