Loading, padding, pfps work now

This commit is contained in:
Bingus_Violet 2024-02-14 15:38:05 -06:00
parent a55036e7d0
commit d20ea8c743
3 changed files with 76 additions and 67 deletions

View file

@ -35,7 +35,8 @@ function searchResultToHTML(results) {
var addedHTML = ""
for (let index = 0; index < results.length; index++) {
const result = results[index].content || results[index];
if (result && result.type == "Video" && result.published && result.duration != "N/A") {
try {
if (result && result.type == "Video" && result.published && result.duration.text != "N/A" && result.thumbnails && result.author.thumbnails) {
if (!result.description_snippet) {
if (result.snippets) {
result.description_snippet = result.snippets[0].text.runs[0]
@ -74,7 +75,7 @@ function searchResultToHTML(results) {
<div class="videoResult container-fluid row">
<div class="col-lg-6 thumbparent">
<a class="videoLink" href="/channel?v=${result.id}">
<img class="pfp" src="${getThumbor()}/${result.author.thumbnails[0].url}">
<img class="pfp" src="${getThumbor()}/https:${result.author.thumbnails[0].url}">
<p style="display: block; text-align: left;">${result.video_count.text}</p>
</a>
</div>
@ -91,6 +92,10 @@ function searchResultToHTML(results) {
} else {
console.log(result.type)
}
} catch (error) {
console.error(error)
console.log(result)
}
}
if (channelsHTML.length > 30) {
@ -100,6 +105,8 @@ function searchResultToHTML(results) {
addedHTML += videosHTML
}
addedHTML += "<style>#hideOnLoad { display: none; }</style>"
return addedHTML
}
@ -140,10 +147,10 @@ app.get("/search", async (req, res) => {
res.write(addedHTML + html.substring(html.indexOf("{RESULTS}") + 9), () => {res.end()})
})
process.on('uncaughtException', (err, origin) => {
fs.writeSync(
process.stderr.fd,
`Caught exception: ${err}\n` +
`Exception origin: ${origin}`,
);
});
// process.on('uncaughtException', (err, origin) => {
// fs.writeSync(
// process.stderr.fd,
// `Caught exception: ${err}\n` +
// `Exception origin: ${origin}`,
// );
// });

View file

@ -27,11 +27,12 @@
<h1>Welcome to SimpleTube</h1>
<p>SimpleTube is a Youtube client that aims to be free, fast, and javascript free. (and has no ads!) </p>
<p>
<a href="https://codeberg.org/Bingus_Violet/SimpleTube">Codeberg</a>
<p class="chip">
<a href="https://codeberg.org/Univerter/SimpleTube">Codeberg</a>
</p>
<div class="row container-fluid">
<h2 id="hideOnLoad">Loading...</h2>
<div class="row container-fluid results">
{RESULTS}
</div>

View file

@ -1,5 +1,6 @@
body, html {
min-height: 100vh;
widtH: 100vw;
padding: 0;
margin: 0;
background-color: rgb(40, 30, 50);
@ -11,12 +12,12 @@ body, html {
line-height: 1.5rem;
}
/* div {
.results {
padding: 0 !important;
margin: 0 !important;
} */
}
a:not(h1 > a):not(.videoLink) {
.chip {
font-size: 1.25rem;
background-color: black;
padding: 8px;
@ -25,7 +26,7 @@ a:not(h1 > a):not(.videoLink) {
border-radius: 8px;
color: rgb(240, 220, 255);
text-decoration: none;
display: inline;
display: inline-block;
}
.videoLink {
@ -158,11 +159,11 @@ p {
margin: 5px auto;
}
.thumbparent {
/* .thumbparent {
justify-content: center;
align-items: center;
display: flex;
}
} */
/* @media (max-width: 1200px) and (min-width: 992px) {
.resultDescription {
@ -181,7 +182,7 @@ p {
}
main {
padding: 5px;
padding: 15px;
}
.pfp {