REFACTOR THE CODEEE BABYYY LESS GOO

This commit is contained in:
Ashley 2023-02-17 21:17:56 +00:00
parent cfccd4417a
commit 98d89a063d

View file

@ -92,6 +92,7 @@ module.exports = function (app, config, renderTemplate) {
h = " "; h = " ";
// YOUTUBE WHY do you WANT me to do this oh ma gosh
if (j.Search) { if (j.Search) {
if ("Results.DynamicItem" in j.Search) { if ("Results.DynamicItem" in j.Search) {
if (j.Search.Results.DynamicItem.id == "didYouMeanRenderer") { if (j.Search.Results.DynamicItem.id == "didYouMeanRenderer") {
@ -134,57 +135,26 @@ module.exports = function (app, config, renderTemplate) {
k = " "; k = " ";
} }
if (req.query.continuation) { // continuation stuff - whoa cool
var continuation = `&continuation=${req.query.continuation}`; let continuation = req.query.continuation ? `&continuation=${req.query.continuation}` : "";
} let continuationl = req.query.continuationl ? `&continuation=${req.query.continuationl}` : "";
let continuations = req.query.continuations ? `&continuation=${req.query.continuations}` : "";
if (!req.query.continuation) { // videos - i dont think this is readable at all but o welp if it works it works:tm:
var continuation = ""; // https://github.com/iv-org/invidious/blob/05258d56bdc3f4de1f0da0c0dbd2d540f68cbdd5/src/invidious/channels/videos.cr
}
try { const tj = await modules.fetch(`https://inv.zzls.xyz/api/v1/channels/videos/${ID}/?sort_by=${req.query.sort_by || "newest"}` + continuation).then((res) => res.text()).then((txt) => getJson(txt)).catch(" ")
//videos const shorts = await modules.fetch(`https://inv.zzls.xyz/api/v1/channels/${ID}/shorts?sort_by=${req.query.sort_by || "newest"}` + continuations).then((res) => res.text()).then((txt) => getJson(txt)).catch(" ")
const a = await modules const stream = await modules.fetch(`https://inv.zzls.xyz/api/v1/channels/${ID}/streams?sort_by=${req.query.sort_by || "newest"}` + continuationl).then((res) => res.text()).then((txt) => getJson(txt)).catch(" ")
.fetch(`https://inv.zzls.xyz/api/v1/channels/videos/${ID}/?sort_by=${req.query.sort_by || "newest"}` + continuation)
.then((res) => res.text());
var tj = await getJson(a); // community tab - protobuf Egljb21tdW5pdHk%3D
} catch { const c = await modules.fetch(`https://inv.zzls.xyz/api/v1/channels/community/${ID}/`).then((res) => res.text()) .then((txt) => getJson(txt));
var tj = " "
}
try {
//videos
const b = await modules
.fetch(`https://inv.zzls.xyz/api/v1/channels/${ID}/shorts?sort_by=${req.query.sort_by || "newest"}` + continuation)
.then((res) => res.text());
var shorts = await getJson(b);
} catch {
var shorts = " "
}
try {
//videos
const c = await modules
.fetch(`https://inv.zzls.xyz/api/v1/channels/${ID}/streams?sort_by=${req.query.sort_by || "newest"}` + continuation)
.then((res) => res.text());
var stream = await getJson(c);
} catch {
var stream = " "
}
const community = await modules
.fetch(`https://inv.zzls.xyz/api/v1/channels/community/${ID}/`)
.then((res) => res.text());
var c = await getJson(community);
try { try {
const summary = await wiki.summary(k.Channel.Metadata.Name); const summary = await wiki.summary(k.Channel.Metadata.Name);
var w = ""; var w = "";
if (summary.title === "Not found.") { if (summary.title === "Not found.") {
w = "none"; w = "none";
} }
@ -227,7 +197,7 @@ module.exports = function (app, config, renderTemplate) {
subs: subs:
typeof subscribers === "string" typeof subscribers === "string"
? subscribers.replace("subscribers", "") ? subscribers.replace("subscribers", "")
: "Private", : "None",
desc: d, desc: d,
}); });
} catch { } catch {