mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-28 21:49:04 +01:00
Update server.js
This commit is contained in:
parent
d695f6a9af
commit
148a6142bf
1 changed files with 13 additions and 7 deletions
14
server.js
14
server.js
|
@ -32,6 +32,7 @@ const renderTemplate = async (res, req, template, data = {}) => {
|
||||||
Object.assign(data)
|
Object.assign(data)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const random_words = [
|
const random_words = [
|
||||||
"banana pie",
|
"banana pie",
|
||||||
"how to buy an atom bomb",
|
"how to buy an atom bomb",
|
||||||
|
@ -43,6 +44,7 @@ const random_words = [
|
||||||
"is a panda a panda if pandas???",
|
"is a panda a panda if pandas???",
|
||||||
"Minecraft movie trailer",
|
"Minecraft movie trailer",
|
||||||
];
|
];
|
||||||
|
|
||||||
const image_urls = [
|
const image_urls = [
|
||||||
"https://cdn.glitch.com/4095e32f-375a-40f2-841e-961cee4c2a95/sheng-l-q2dUSl9S4Xg-unsplash.jpg?v=1655990895950",
|
"https://cdn.glitch.com/4095e32f-375a-40f2-841e-961cee4c2a95/sheng-l-q2dUSl9S4Xg-unsplash.jpg?v=1655990895950",
|
||||||
"https://cdn.glitch.com/4095e32f-375a-40f2-841e-961cee4c2a95/willian-justen-de-vasconcellos-T_Qe4QlMIvQ-unsplash(1).jpg?v=1655991004992",
|
"https://cdn.glitch.com/4095e32f-375a-40f2-841e-961cee4c2a95/willian-justen-de-vasconcellos-T_Qe4QlMIvQ-unsplash(1).jpg?v=1655991004992",
|
||||||
|
@ -71,6 +73,7 @@ app.get("/watch", async function (req, res) {
|
||||||
var v = req.query.v;
|
var v = req.query.v;
|
||||||
var e = req.query.e;
|
var e = req.query.e;
|
||||||
var r = req.query.r;
|
var r = req.query.r;
|
||||||
|
var f = req.query.f;
|
||||||
var t = req.query.t;
|
var t = req.query.t;
|
||||||
const video = await fetch(config.tubeApi + `video?v=${v}`);
|
const video = await fetch(config.tubeApi + `video?v=${v}`);
|
||||||
const h = await video.text();
|
const h = await video.text();
|
||||||
|
@ -83,6 +86,11 @@ app.get("/watch", async function (req, res) {
|
||||||
if (j_.URL != undefined) url = j_.URL;
|
if (j_.URL != undefined) url = j_.URL;
|
||||||
const json = fetching.video.Player;
|
const json = fetching.video.Player;
|
||||||
const engagement = fetching.engagement;
|
const engagement = fetching.engagement;
|
||||||
|
const channel = await fetch(
|
||||||
|
config.tubeApi + `channel?id=${json.Channel.id}&tab=videos`
|
||||||
|
);
|
||||||
|
const c = await channel.text();
|
||||||
|
const tj = JSON.parse(toJson(c));
|
||||||
const lyrics = await lyricsFinder(json.Title);
|
const lyrics = await lyricsFinder(json.Title);
|
||||||
if (lyrics == undefined) lyrics = "Lyrics not found";
|
if (lyrics == undefined) lyrics = "Lyrics not found";
|
||||||
renderTemplate(res, req, "poketube.ejs", {
|
renderTemplate(res, req, "poketube.ejs", {
|
||||||
|
@ -95,14 +103,15 @@ app.get("/watch", async function (req, res) {
|
||||||
date: moment(k.Video.uploadDate).format("LL"),
|
date: moment(k.Video.uploadDate).format("LL"),
|
||||||
e: e,
|
e: e,
|
||||||
k: k,
|
k: k,
|
||||||
|
tj: tj,
|
||||||
r: r,
|
r: r,
|
||||||
|
f: f,
|
||||||
t: config.t_url,
|
t: config.t_url,
|
||||||
optout: t,
|
optout: t,
|
||||||
lyrics: lyrics.replace(/\n/g, " <br> "),
|
lyrics: lyrics.replace(/\n/g, " <br> "),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
app.get("/download", async function (req, res) {
|
app.get("/download", async function (req, res) {
|
||||||
var v = req.query.v;
|
var v = req.query.v;
|
||||||
|
|
||||||
|
@ -165,8 +174,6 @@ app.get("/music", async function (req, res) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
app.get("/old/watch", async function (req, res) {
|
app.get("/old/watch", async function (req, res) {
|
||||||
var v = req.query.v;
|
var v = req.query.v;
|
||||||
var e = req.query.e;
|
var e = req.query.e;
|
||||||
|
@ -285,7 +292,6 @@ app.get("*", function (req, res) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
app.listen("3000", () => {});
|
app.listen("3000", () => {});
|
||||||
|
|
Loading…
Reference in a new issue