From 184f58a147dde874934e4f812199d19d60d631b7 Mon Sep 17 00:00:00 2001 From: Violet <110205356+Violets-puragtory@users.noreply.github.com> Date: Mon, 8 May 2023 17:52:41 +0000 Subject: [PATCH] oi --- index.js | 15 +++++++----- static/index.html | 61 +++++++++++++++++++++++++---------------------- static/main.js | 17 ------------- static/style.css | 47 ++++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 51 deletions(-) delete mode 100644 static/main.js diff --git a/index.js b/index.js index 4121028..cec4fac 100644 --- a/index.js +++ b/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.') + } }); diff --git a/static/index.html b/static/index.html index 218e108..ab07d88 100644 --- a/static/index.html +++ b/static/index.html @@ -6,40 +6,45 @@ - - + + + + Youtube Downloader -

Youtube Downloader

+

Youtube Downloader +
+

- - - - - - - - +

Video URL:

+
+
+ +

Quality:

+
+ +
+ +
+ +
diff --git a/static/main.js b/static/main.js deleted file mode 100644 index c8408ea..0000000 --- a/static/main.js +++ /dev/null @@ -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 - } - -} \ No newline at end of file diff --git a/static/style.css b/static/style.css index e69de29..8e56479 100644 --- a/static/style.css +++ b/static/style.css @@ -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; +} \ No newline at end of file