mirror of
https://codeberg.org/ashley/poke.git
synced 2024-12-01 10:07:24 +01:00
reformat file
This commit is contained in:
parent
c28c0f2f92
commit
5266951db8
1 changed files with 48 additions and 27 deletions
71
server.js
71
server.js
|
@ -192,33 +192,17 @@ 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];
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var nnn = "";
|
|
||||||
|
|
||||||
if (n === "none") {
|
|
||||||
nnn = "";
|
|
||||||
}
|
|
||||||
if (IsJsonString(n)) {
|
|
||||||
if (n !== "none") {
|
|
||||||
nnn = JSON.parse(n);
|
nnn = JSON.parse(n);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var comments = "";
|
|
||||||
if (n === "none") {
|
|
||||||
comments = "";
|
|
||||||
}
|
|
||||||
if (IsJsonString(n)) {
|
|
||||||
if (n !== "none") {
|
|
||||||
comments = JSON.parse(n).commentCount;
|
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: "",
|
||||||
|
|
Loading…
Reference in a new issue