From 97e6d472f036d581a9180e73a27d950df4e71a7e Mon Sep 17 00:00:00 2001 From: Ashley Date: Wed, 21 Sep 2022 10:50:15 +0200 Subject: [PATCH] new about section :3 --- server.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 86ab071d..46b45efd 100644 --- a/server.js +++ b/server.js @@ -430,7 +430,9 @@ app.get("/search", async (req, res) => { app.get("/channel/", async (req, res) => { const ID = req.query.id; - + const tab = req.query.tab; + + // about const bout = await fetch(config.tubeApi + `channel?id=${ID}&tab=about`); @@ -441,12 +443,24 @@ app.get("/channel/", async (req, res) => { const channel = await fetch(config.tubeApi + `channel?id=${ID}&tab=videos`); const c = await channel.text(); const tj = JSON.parse(toJson(c)); + + const summary = await wiki.summary(k.Channel.Metadata.Name); + var w = ""; + if (summary.title === "Not found.") { + w = "none"; + } + if (summary.title !== "Not found.") { + w = summary; + } + const { Subscribers: subscribers } = k.Channel.Metadata; renderTemplate(res, req, "channel.ejs", { ID: ID, + tab: tab, j: k, tj: tj, + wiki: w, about: k.Channel.Contents.ItemSection.About, subs: typeof subscribers === "string"