new embeds :3

This commit is contained in:
Ashley 2022-09-22 12:05:32 +02:00
parent a23c78397b
commit 0bae1b7920

View file

@ -453,11 +453,11 @@ app.get("/channel/", async (req, res) => {
} }
const { Subscribers: subscribers } = k.Channel.Metadata; const { Subscribers: subscribers } = k.Channel.Metadata;
const description = k.Channel.Contents.ItemSection.About.Description const description = k.Channel.Contents.ItemSection.About.Description;
var d = description.toString().replace(/\n/g, " <br> ") var d = description.toString().replace(/\n/g, " <br> ");
if(d === "[object Object]"){ if (d === "[object Object]") {
var d = "" var d = "";
} }
renderTemplate(res, req, "channel.ejs", { renderTemplate(res, req, "channel.ejs", {
@ -472,7 +472,7 @@ app.get("/channel/", async (req, res) => {
typeof subscribers === "string" typeof subscribers === "string"
? subscribers.replace("subscribers", "") ? subscribers.replace("subscribers", "")
: "Private", : "Private",
desc: d desc: d,
}); });
}); });
@ -508,9 +508,37 @@ app.get("/video/upload", (req, res) => {
///////////// API ///////////// ///////////// API /////////////
app.get("/embed/:v", async function (req, res) { app.get("/embed/:v", async function (req, res) {
var e = req.query.e;
var f = req.query.f;
var t = req.query.t;
var q = req.query.quality;
var v = req.params.v; var v = req.params.v;
res.redirect(`https://tube.kuylar.dev/proxy/media/${v}/18`); var fetching = await fetcher(v);
const video = await fetch(config.tubeApi + `video?v=${v}`);
const json = fetching.video.Player;
const h = await video.text();
const k = JSON.parse(toJson(h));
const engagement = fetching.engagement;
if (!v) res.redirect("/");
//video
if (!q) url = `https://tube.kuylar.dev/proxy/media/${v}/22`;
if (q === "medium") {
var url = `https://tube.kuylar.dev/proxy/media/${v}/18`;
}
renderTemplate(res, req, "poketube-iframe.ejs", {
video: json,
url: url,
sha384: sha384,
qua: q,
engagement: engagement,
optout: t,
t: config.t_url,
});
}); });
app.get("/api/search", async (req, res) => { app.get("/api/search", async (req, res) => {
@ -572,8 +600,6 @@ app.get("/video/upload", (req, res) => {
res.redirect("https://youtube.com/upload"); res.redirect("https://youtube.com/upload");
}); });
///////////// 404 AND MAIN PAGES ETC ///////////// ///////////// 404 AND MAIN PAGES ETC /////////////
app.get("/", async function (req, res) { app.get("/", async function (req, res) {
const trends = await fetch(config.tubeApi + `trending`); const trends = await fetch(config.tubeApi + `trending`);
@ -585,7 +611,6 @@ app.get("/", async function (req, res) {
}); });
}); });
app.get("*", function (req, res) { app.get("*", function (req, res) {
const things = random_words[Math.floor(Math.random() * random_words.length)]; const things = random_words[Math.floor(Math.random() * random_words.length)];
renderTemplate(res, req, "404.ejs", { renderTemplate(res, req, "404.ejs", {
@ -593,7 +618,7 @@ app.get("*", function (req, res) {
}); });
}); });
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// listen // listen