diff --git a/index.js b/index.js index 6a5c5d2..d09d122 100644 --- a/index.js +++ b/index.js @@ -54,24 +54,28 @@ app.get("/search", async (req, res) => { for (let index = 0; index < videos.length; index++) { const result = videos[index]; addedHTML += ` -
-
- - - -
-
- -

${result.title}

-

${result.description}


- -
${result.channel.name} - + - ` - console.log(result) } res.send(html.replace("{RESULTS}", addedHTML)) @@ -136,20 +140,20 @@ app.get("/video", async (req, res) => { var debounce = true var dp = 0 - ytdl(id, { filter: "videoandaudio", quality: "highest", format: 'mp4' }) + ytdl(id, { filter: 'videoandaudio', quality: "highest", format: 'mp4' }) .on("progress", (chunk, ct, et) => { - if (debounce) { + if (debounce && ct > Math.min(et, 5000000)) { debounce = false videoCache[id] = { "path": vidpath, "size": et, "downloaded": false, "download%": 0 - } + } ready(vidpath, fs.readFileSync(vidpath)) } var percent = Math.round(ct / et * 100) - if (percent > dp) { + if (!debounce && percent > dp) { dp = percent videoCache[id]["download%"] = dp } @@ -206,7 +210,7 @@ app.get("/watch", async (req, res) => { if (!(id in videoCache && videoCache[id]["downloaded"] == true)) { html = html.replace("{CACHE_WARNING}", `

Please note that this video has not been fully cached, and may have trouble loading! -
{DOWNLOAD_PERCENT}% cached (as of page load).

+
{DOWNLOAD_PERCENT}% cached as of page load. If content fails to load after a minute, reload the page!

`) if (id in videoCache && "download%" in videoCache[id]) { html = html.replace("{DOWNLOAD_PERCENT}", videoCache[id]["download%"]) diff --git a/resources/player.html b/resources/player.html index a37005a..1a1153b 100644 --- a/resources/player.html +++ b/resources/player.html @@ -32,10 +32,10 @@

{VIDEO_TITLE}

- {CACHE_WARNING}
+ {CACHE_WARNING}

Description:

-

{VIDEO_DESCRIPTION}

+

{VIDEO_DESCRIPTION}

diff --git a/resources/searchPage.html b/resources/searchPage.html index d4de18c..ddff999 100644 --- a/resources/searchPage.html +++ b/resources/searchPage.html @@ -14,10 +14,10 @@
-
+ -
+
diff --git a/static/Images/UnknownPFP.jpg b/static/Images/UnknownPFP.jpg new file mode 100644 index 0000000..aaf0b81 Binary files /dev/null and b/static/Images/UnknownPFP.jpg differ diff --git a/static/Images/UnknownVideo.jpg b/static/Images/UnknownVideo.jpg new file mode 100644 index 0000000..09715b5 Binary files /dev/null and b/static/Images/UnknownVideo.jpg differ diff --git a/static/index.html b/static/index.html index b980664..67f7a20 100644 --- a/static/index.html +++ b/static/index.html @@ -13,7 +13,7 @@ -
+
diff --git a/static/mainStyle.css b/static/mainStyle.css index 104100a..9d8e834 100644 --- a/static/mainStyle.css +++ b/static/mainStyle.css @@ -17,7 +17,7 @@ body, html { } */ a:not(h1 > a):not(.videoLink) { - font-size: 1.5rem; + font-size: 1.25rem; background-color: black; padding: 8px; margin: 5px; @@ -25,6 +25,7 @@ a:not(h1 > a):not(.videoLink) { border-radius: 15px; color: rgb(240, 220, 255); text-decoration: none; + display: inline; } .videoLink { @@ -42,7 +43,7 @@ a:not(h1 > a):not(.videoLink) { } #titleBar { - width: 100vw; + width: 100%; background-color: rgb(5, 0, 10); /* border: 0px; */ border: 2px transparent solid; @@ -50,7 +51,7 @@ a:not(h1 > a):not(.videoLink) { position: sticky; top: 0px; margin: 0; - padding: 0; + padding: 10px; } #titleBar > div > * { @@ -109,22 +110,52 @@ a:not(h1 > a):not(.videoLink) { } p { - padding: 5px; + padding: 2px; } .videoResult { background-color: black; border: 2px gray solid; border-radius: 10px; - padding: 10px; - margin: 10px; + padding: 3px; + margin: auto; text-align: left; + height: 100%; + } -img { - width: 70%; +@media (max-width: 768px) { + .resultContainer { + max-width: 450px; + } } +.resultContainer { + margin: 5px auto; +} + +.thumbnail { + width: 100%; + margin: auto; + border-radius: 20px; + aspect-ratio: 16/9; + object-fit: cover; + border: 2px white solid; + margin: 5px auto; +} + +.thumbparent { + justify-content: center; + align-items: center; + display: flex; +} + +/* @media (max-width: 1200px) and (min-width: 992px) { + .resultDescription { + display: none; + } +} */ + .minipfp { width: 60px; height: 60px; @@ -132,4 +163,5 @@ img { border-radius: 50%; padding: 0; margin: 0; + display: inline-block; } \ No newline at end of file