mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 09:18:27 +01:00
REFACTOR THE CODEEE BABYYY LESS GOO
This commit is contained in:
parent
cfccd4417a
commit
98d89a063d
1 changed files with 18 additions and 48 deletions
|
@ -91,7 +91,8 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
const j = JSON.parse(modules.toJson(text));
|
const j = JSON.parse(modules.toJson(text));
|
||||||
|
|
||||||
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") {
|
||||||
|
@ -133,58 +134,27 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
} catch {
|
} catch {
|
||||||
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) {
|
|
||||||
var continuation = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
//videos
|
|
||||||
const a = await modules
|
|
||||||
.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);
|
|
||||||
} catch {
|
|
||||||
var tj = " "
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
// videos - i dont think this is readable at all but o welp if it works it works:tm:
|
||||||
//videos
|
// https://github.com/iv-org/invidious/blob/05258d56bdc3f4de1f0da0c0dbd2d540f68cbdd5/src/invidious/channels/videos.cr
|
||||||
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);
|
|
||||||
|
|
||||||
|
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(" ")
|
||||||
|
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 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(" ")
|
||||||
|
|
||||||
|
// community tab - protobuf Egljb21tdW5pdHk%3D
|
||||||
|
const c = await modules.fetch(`https://inv.zzls.xyz/api/v1/channels/community/${ID}/`).then((res) => res.text()) .then((txt) => getJson(txt));
|
||||||
|
|
||||||
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 {
|
||||||
|
|
Loading…
Reference in a new issue