comments :3

This commit is contained in:
Ashley 2022-10-12 17:04:41 +02:00
parent c27e5afbca
commit 925823e9f5

142
server.js
View file

@ -170,92 +170,84 @@ app.get("/watch", async function (req, res) {
var f = req.query.f; var f = req.query.f;
var t = req.query.t; var t = req.query.t;
var q = req.query.quality; var q = req.query.quality;
const info = await fetch("http://ip-api.com/json/");
const info = await fetch("http://ip-api.com/json/");
const jj = await info.text(); const jj = await info.text();
const ip = JSON.parse(jj); const ip = JSON.parse(jj);
api.video(v).then((data) => { api.video(v).then((data) => {
const k = data.video;
const json = data.json;
const k = data.video const engagement = data.engagement;
const json = data.json const inv_comments = data.comments;
const engagement = data.engagement const inv_vid = data.vid;
if(api.video(v).b) { if (api.video(v).b) {
var nnn = data.beta var nnn = data.beta;
var badges = nnn.channel.badges[0]; var badges = nnn.channel.badges[0];
var comments = nnn.commentCount; var comments = nnn.commentCount;
} }
if(!api.video(v).b) {
var nnn = ""
var badges = ""
var comments = ""
}
if (!api.video(v).b) {
var nnn = "";
if (!v) res.redirect("/"); var badges = "";
var comments = "";
}
//video if (!v) res.redirect("/");
if (!q) url = `https://tube.kuylar.dev/proxy/media/${v}/22`;
if (q === "medium") {
var url = `https://tube.kuylar.dev/proxy/media/${v}/18`;
}
// encryption //video
const url_e = if (!q) url = `https://tube.kuylar.dev/proxy/media/${v}/22`;
url + if (q === "medium") {
"?e=" + var url = `https://tube.kuylar.dev/proxy/media/${v}/18`;
sha384(k.Video.Channel.id) + }
sha384(k.Video.Channel.id) +
"Piwik" +
sha384(config.t_url);
const desc = data.desc; // encryption
const url_e =
url +
"?e=" +
sha384(k.Video.Channel.id) +
sha384(k.Video.Channel.id) +
"Piwik" +
sha384(config.t_url);
var d = desc.toString().replace(/\n/g, " <br> "); const desc = data.desc;
if (d === "[object Object]") { var d = desc.toString().replace(/\n/g, " <br> ");
var d = false;
}
if (d === "[object Object]") {
var d = false;
}
renderTemplate(res, req, "poketube.ejs", {
renderTemplate(res, req, "poketube.ejs", { url: url_e,
url: url_e, color: data.color,
color: data.color, engagement: engagement,
engagement: engagement, video: json,
video: json, date: moment(k.Video.uploadDate).format("LL"),
date: moment(k.Video.uploadDate).format("LL"), e: e,
e: e, k: k,
k: k, process: process,
process: process, sha384: sha384,
sha384: sha384, isMobile: req.useragent.isMobile,
isMobile: req.useragent.isMobile, tj: data.channel,
tj: data.channel, r: r,
r: r, qua: q,
qua: q, inv: inv_comments,
ip: ip, ip: ip,
convert: convert, convert: convert,
wiki: data.wiki, wiki: data.wiki,
f: f, f: f,
t: config.t_url, t: config.t_url,
optout: t, optout: t,
badges: badges, badges: badges,
desc: desc, desc: desc,
comments: comments, comments: comments,
n: nnn, n: nnn,
lyrics: "", inv_vid,
}); lyrics: "",
}); });
});
}); });
app.get("/music", async function (req, res) { app.get("/music", async function (req, res) {
@ -280,11 +272,12 @@ app.get("/music", async function (req, res) {
if (!v) res.redirect("/"); if (!v) res.redirect("/");
const video = await fetch(config.tubeApi + `video?v=${v}`);
var fetching = await fetcher(v); var fetching = await fetcher(v);
const json = fetching.video.Player; const json = fetching.video.Player;
const video = await fetch(config.tubeApi + `video?v=${v}`);
const h = await video.text(); const h = await video.text();
const k = JSON.parse(toJson(h)); const k = JSON.parse(toJson(h));
@ -547,6 +540,7 @@ app.get("/embed/:v", async function (req, res) {
sha384: sha384, sha384: sha384,
qua: q, qua: q,
engagement: engagement, engagement: engagement,
k: k,
optout: t, optout: t,
t: config.t_url, t: config.t_url,
}); });