mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 11:18:29 +01:00
checkUnexistingObject lel
This commit is contained in:
parent
e6f153bb78
commit
380c66ed01
1 changed files with 12 additions and 2 deletions
|
@ -36,6 +36,14 @@ function getJson(str) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkUnexistingObject(obj) {
|
||||||
|
if (obj !== undefined) {
|
||||||
|
if (obj.authorId !== undefined) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Api functions
|
* Api functions
|
||||||
*/
|
*/
|
||||||
|
@ -59,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()
|
||||||
|
@ -72,6 +80,7 @@ async function video(v) {
|
||||||
);
|
);
|
||||||
|
|
||||||
var vid = await getJson(video_new_info);
|
var vid = await getJson(video_new_info);
|
||||||
|
if(checkUnexistingObject(vid)) {
|
||||||
|
|
||||||
const a = await fetch(`${config.tubeApi}channel?id=${vid.authorId}&tab=about`)
|
const a = await fetch(`${config.tubeApi}channel?id=${vid.authorId}&tab=about`)
|
||||||
.then((res) => res.text())
|
.then((res) => res.text())
|
||||||
|
@ -103,6 +112,7 @@ async function video(v) {
|
||||||
`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()),
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function search(query, cnt) {
|
async function search(query, cnt) {
|
||||||
|
|
Loading…
Reference in a new issue