reformat file

This commit is contained in:
Ashley 2022-09-24 22:52:20 +02:00
parent 1481da5f49
commit 233ac7d460

View file

@ -192,34 +192,18 @@ app.get("/watch", async function (req, res) {
} }
var nn = ""; var nn = "";
var nnn = "";
var comments = "";
if (n === "none") { if (n === "none") {
badges = ""; badges, nnn, comments = "";
} }
if (IsJsonString(n)) { if (IsJsonString(n)) {
if (n !== "none") { if (n !== "none") {
badges = JSON.parse(n).channel.badges[0]; badges = JSON.parse(n).channel.badges[0];
} nnn = JSON.parse(n);
} comments = JSON.parse(n).commentCount;
var nnn = "";
if (n === "none") {
nnn = "";
}
if (IsJsonString(n)) {
if (n !== "none") {
nnn = JSON.parse(n);
}
}
var comments = "";
if (n === "none") {
comments = "";
}
if (IsJsonString(n)) {
if (n !== "none") {
comments = JSON.parse(n).commentCount;
} }
} }
@ -253,8 +237,20 @@ app.get("/watch", async function (req, res) {
const c = await channel.text(); const c = await channel.text();
const tj = JSON.parse(toJson(c)); const tj = JSON.parse(toJson(c));
// lyrics // about
// const lyrics = await lyricsFinder(json.Title); const abtchnl = await fetch(
config.tubeApi + `channel?id=${k.Video.Channel.id}&tab=about`
);
const ab = await abtchnl.text();
const a = JSON.parse(toJson(ab));
const desc = a.Channel.Contents.ItemSection.About.Description;
var d = desc.toString().replace(/\n/g, " <br> ");
if (d === "[object Object]") {
var d = false;
}
const summary = await wiki.summary(k.Video.Channel.Name); const summary = await wiki.summary(k.Video.Channel.Name);
@ -266,11 +262,35 @@ app.get("/watch", async function (req, res) {
w = summary; w = summary;
} }
/***********
* URL = Video URl
* color= embed color
* engagement = engagement data
* video = video json info
* date = upload date
* e = embed
* k = player
* process = process information
* sha384 = encryption
* isMobile = to check if its mobile or not
* tj = channel videos page
* r = recommended videos
* qua = quality obv
* ip = ip info
* convert = formats a number
* wiki = wikipedia info
* f = recent videos from this channel
* t = default piwik url
* optout = piwik optout
* badges = channel badges
* desc = channel description
* comments = comment size
* nnn = nigthly stuff
* lyrics = depracated
*/
renderTemplate(res, req, "poketube.ejs", { renderTemplate(res, req, "poketube.ejs", {
url: url_e, url: url_e,
color: await getColors( color: await getColors( `https://i.ytimg.com/vi/${v}/maxresdefault.jpg` ).then((colors) => colors[0].hex()),
`https://i.ytimg.com/vi/${v}/maxresdefault.jpg`
).then((colors) => colors[0].hex()),
engagement: engagement, engagement: engagement,
video: json, video: json,
date: moment(k.Video.uploadDate).format("LL"), date: moment(k.Video.uploadDate).format("LL"),
@ -289,6 +309,7 @@ app.get("/watch", async function (req, res) {
t: config.t_url, t: config.t_url,
optout: t, optout: t,
badges: badges, badges: badges,
desc:desc,
comments: comments, comments: comments,
n: nnn, n: nnn,
lyrics: "", lyrics: "",