From 380c66ed01d8335c14edfebd67f89c5bc4ea38d1 Mon Sep 17 00:00:00 2001 From: Ashley Date: Fri, 16 Dec 2022 19:11:53 +0000 Subject: [PATCH] checkUnexistingObject lel --- src/libpoketube/libpoketube-core.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libpoketube/libpoketube-core.js b/src/libpoketube/libpoketube-core.js index a528af67..687d8337 100644 --- a/src/libpoketube/libpoketube-core.js +++ b/src/libpoketube/libpoketube-core.js @@ -36,6 +36,14 @@ function getJson(str) { } } + function checkUnexistingObject(obj) { + if (obj !== undefined) { + if (obj.authorId !== undefined) { + return true; + } + } +} + /* * Api functions */ @@ -58,8 +66,8 @@ async function channel(id, cnt) { async function video(v) { if (v == null) return "Gib ID"; - - let nightlyRes; + + let nightlyRes; var inv_comments = await fetch(`${config.invapi}/comments/${v}`).then((res) => res.text() @@ -72,6 +80,7 @@ async function video(v) { ); var vid = await getJson(video_new_info); + if(checkUnexistingObject(vid)) { const a = await fetch(`${config.tubeApi}channel?id=${vid.authorId}&tab=about`) .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` ).then((colors) => colors[1].hex()), }; + } } async function search(query, cnt) {