oi
This commit is contained in:
parent
732bf7476d
commit
184f58a147
4 changed files with 89 additions and 51 deletions
15
index.js
15
index.js
|
@ -7,14 +7,17 @@ const PORT = process.env.PORT || 8080
|
|||
const app = express()
|
||||
|
||||
app.get("/download", (req, res) => {
|
||||
res.header('Content-Type', 'video');
|
||||
|
||||
const url = req.query.url;
|
||||
const filename = req.query.filename
|
||||
const url = req.query.url
|
||||
const format= req.query.format
|
||||
const quality = req.query.quality
|
||||
console.log(req.query.url)
|
||||
res.header('Content-Disposition', `attachment; filename="test.${format}"`);
|
||||
ytdl(url, {'format': format, 'quality': quality}).pipe(res);
|
||||
|
||||
if ((filename === 'string' && url === 'string' && format === 'string' && quality === 'string')) {
|
||||
res.header('Content-Disposition', `attachment; filename="${filename}.${format}"`);
|
||||
ytdl(url, {'format': format, 'quality': quality}).pipe(res);
|
||||
} else {
|
||||
res.send('Please input proper values in all fields.')
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -6,40 +6,45 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.4.min.js"
|
||||
integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script>
|
||||
<!-- <script src="./main.js"></script> -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.min.js" integrity="sha384-cuYeSxntonz0PPNlHhBs68uyIAVpIIOZZ5JqeqvYYIcEL727kskC66kF92t6Xl2V" crossorigin="anonymous"></script>
|
||||
|
||||
<link rel="stylesheet" href="./style.css">
|
||||
|
||||
<title>Youtube Downloader</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1>Youtube Downloader</h1>
|
||||
<h1>Youtube Downloader
|
||||
<hr>
|
||||
</h1>
|
||||
<form action="download" method="get" target="_blank">
|
||||
<input id="url" placeholder="Enter url" name="url">
|
||||
<label for="quality">Quality</label>
|
||||
<select id="quality" name="quality">
|
||||
<option value="highest">Select Quality</option>
|
||||
<option value="highest">highest</option>
|
||||
<option value="lowest">lowest</option>
|
||||
<option value="highestaudio">highestaudio</option>
|
||||
<option value="lowestaudio">lowestaudio</option>
|
||||
<option value="highestvideo">highestvideo</option>
|
||||
<option value="lowestvideo">lowestvideo</option>
|
||||
</select>
|
||||
<label for="filename">SaveAs</label>
|
||||
<input id="filename" placeholder="Enter filename">
|
||||
<label for="format">Format</label>
|
||||
<select id="format" name="format">
|
||||
<option value="format">Select Format</option>
|
||||
<option value="mp4">mp4</option>
|
||||
<option value="wmv">wmv</option>
|
||||
<option value="flv">flv</option>
|
||||
<option value="avi">avi</option>
|
||||
<option value="mp3">mp3</option>
|
||||
<option value="mpg">mpg</option>
|
||||
</select>
|
||||
<input type="submit" placeholder="test">
|
||||
<p style="margin-bottom: 1px;">Video URL:</p>
|
||||
<div class="grid-container">
|
||||
<input required id="url" placeholder="Enter url" name="url"><br>
|
||||
<!-- <label for="quality">Quality:</label> -->
|
||||
<p>Quality:</p>
|
||||
<select required id="quality" name="quality">
|
||||
<option value="lowestaudio">Lowest (Audio Only)</option>
|
||||
<option value="highestaudio">Highest (Audio Only)</option>
|
||||
<option value="highestvideo">Highest (Video Only)</option>
|
||||
<option value="lowestvideo">Lowest (Video Only)</option>
|
||||
<option value="highest">Highest</option>
|
||||
<option value="lowest">Lowest</option>
|
||||
</select><br>
|
||||
<!-- <label for="filename">Save As:</label> -->
|
||||
<input id="filename" placeholder="Enter filename" name="filename"><br>
|
||||
<!-- <label for="format">Format:</label> -->
|
||||
<select required id="format" name="format">
|
||||
<option value="mp4">mp4</option>
|
||||
<option value="wmv">wmv</option>
|
||||
<option value="flv">flv</option>
|
||||
<option value="avi">avi</option>
|
||||
<option value="mp3">mp3</option>
|
||||
<option value="mpg">mpg</option>
|
||||
</select><br>
|
||||
<input type="submit" placeholder="test">
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
function gamer() {
|
||||
const quality = document.getElementById('quality')
|
||||
const filename = document.getElementById('filename')
|
||||
const format = document.getElementById('format')
|
||||
const downloadBtn = document.getElementById('download')
|
||||
|
||||
downloadBtn.innerText = "Downloading file..."
|
||||
|
||||
var url = $("#url").text()
|
||||
var message = {
|
||||
'url': url,
|
||||
'quality': quality.value,
|
||||
'filename': filename.value,
|
||||
'format': format.value
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
:root {
|
||||
--text-color: rgb(230, 210, 255);
|
||||
--background-color: rgb(50, 35, 75);
|
||||
--second-bg-color: black;
|
||||
}
|
||||
|
||||
* {
|
||||
text-align: center;
|
||||
color: var(--text-color);
|
||||
font-family: Verdana, Geneva, Tahoma, sans-serif;
|
||||
}
|
||||
|
||||
p, select, input {
|
||||
font-size: 1.4rem;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
body, html {
|
||||
background-color: var(--background-color);
|
||||
}
|
||||
|
||||
.grid-container {
|
||||
width: 100%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
/* .grid-container > *:not(select, input) {
|
||||
float: left;
|
||||
} */
|
||||
|
||||
select, input{
|
||||
display: inline-grid;
|
||||
background-color: var(--second-bg-color);
|
||||
color: var(--text-color);
|
||||
margin: 5px auto;
|
||||
border: 2px var(--text-color) solid;
|
||||
border-radius: 5px;
|
||||
/* width: 70%; */
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 1.5rem;
|
||||
}
|
Loading…
Reference in a new issue