mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-23 02:37:49 +01:00
add != "assets"
This commit is contained in:
parent
6e9abcf324
commit
c66863e69a
1 changed files with 49 additions and 43 deletions
|
@ -36,10 +36,10 @@ function getJson(str) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkUnexistingObject(obj) {
|
function checkUnexistingObject(obj) {
|
||||||
if (obj !== undefined) {
|
if (obj !== undefined) {
|
||||||
if (obj.authorId !== undefined) {
|
if (obj.authorId !== undefined) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ async function channel(id, cnt) {
|
||||||
async function video(v) {
|
async function video(v) {
|
||||||
if (v == null) return "Gib ID";
|
if (v == null) return "Gib ID";
|
||||||
|
|
||||||
let nightlyRes;
|
let nightlyRes;
|
||||||
|
|
||||||
var inv_comments = await fetch(`${config.invapi}/comments/${v}`).then((res) =>
|
var inv_comments = await fetch(`${config.invapi}/comments/${v}`).then((res) =>
|
||||||
res.text()
|
res.text()
|
||||||
|
@ -80,38 +80,41 @@ async function video(v) {
|
||||||
);
|
);
|
||||||
|
|
||||||
var vid = await getJson(video_new_info);
|
var vid = await getJson(video_new_info);
|
||||||
if(checkUnexistingObject(vid)) {
|
if (checkUnexistingObject(vid)) {
|
||||||
|
const a = await fetch(
|
||||||
const a = await fetch(`${config.tubeApi}channel?id=${vid.authorId}&tab=about`)
|
`${config.tubeApi}channel?id=${vid.authorId}&tab=about`
|
||||||
.then((res) => res.text())
|
)
|
||||||
.then((xml) => getJson(toJson(xml)));
|
|
||||||
|
|
||||||
const summary = await wiki
|
|
||||||
.summary(vid.author + " ")
|
|
||||||
.then((summary_) => (summary_.title !== "Not found." ? summary_ : "none"));
|
|
||||||
|
|
||||||
const desc = a.Channel?.Contents.ItemSection.About.Description;
|
|
||||||
|
|
||||||
const data = await fetcher(v);
|
|
||||||
|
|
||||||
const nightlyJsonData = getJson(nightlyRes);
|
|
||||||
return {
|
|
||||||
json: data.video.Player,
|
|
||||||
video: await fetch(`${config.tubeApi}video?v=${v}`)
|
|
||||||
.then((res) => res.text())
|
.then((res) => res.text())
|
||||||
.then((xml) => getJson(toJson(xml))),
|
.then((xml) => getJson(toJson(xml)));
|
||||||
vid,
|
|
||||||
comments,
|
const summary = await wiki
|
||||||
engagement: data.engagement,
|
.summary(vid.author + " ")
|
||||||
wiki: summary,
|
.then((summary_) =>
|
||||||
desc: desc,
|
summary_.title !== "Not found." ? summary_ : "none"
|
||||||
color: await getColors(
|
);
|
||||||
`https://i.ytimg.com/vi/${v}/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw`
|
|
||||||
).then((colors) => colors[0].hex()),
|
const desc = a.Channel?.Contents.ItemSection.About.Description;
|
||||||
|
|
||||||
|
const data = await fetcher(v);
|
||||||
|
|
||||||
|
const nightlyJsonData = getJson(nightlyRes);
|
||||||
|
return {
|
||||||
|
json: data.video.Player,
|
||||||
|
video: await fetch(`${config.tubeApi}video?v=${v}`)
|
||||||
|
.then((res) => res.text())
|
||||||
|
.then((xml) => getJson(toJson(xml))),
|
||||||
|
vid,
|
||||||
|
comments,
|
||||||
|
engagement: data.engagement,
|
||||||
|
wiki: summary,
|
||||||
|
desc: desc,
|
||||||
|
color: await getColors(
|
||||||
|
`https://i.ytimg.com/vi/${v}/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw`
|
||||||
|
).then((colors) => colors[0].hex()),
|
||||||
color2: await getColors(
|
color2: await getColors(
|
||||||
`https://i.ytimg.com/vi/${v}/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw`
|
`https://i.ytimg.com/vi/${v}/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw`
|
||||||
).then((colors) => colors[1].hex()),
|
).then((colors) => colors[1].hex()),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,16 +131,19 @@ async function search(query, cnt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function isvalidvideo(v) {
|
async function isvalidvideo(v) {
|
||||||
var status;
|
if (v != "assets") {
|
||||||
const vld = await fetch(`${config.dislikes}${v}`).then((res) => {
|
var status;
|
||||||
status = res.status;
|
|
||||||
return res.json();
|
|
||||||
});
|
|
||||||
|
|
||||||
if (status == 400) {
|
const vld = await fetch(`${config.dislikes}${v}`).then((res) => {
|
||||||
return false;
|
status = res.status;
|
||||||
} else {
|
return res.json();
|
||||||
return true;
|
});
|
||||||
|
|
||||||
|
if (status == 400) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue