1
Fork 0

add != "assets"

This commit is contained in:
Ashley 2022-12-18 14:11:24 +00:00
parent 6e9abcf324
commit c66863e69a

View file

@ -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;
} }
} }
} }
@ -66,8 +66,8 @@ 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;
}
} }
} }