From 6f196fe0f46809a592bf01d0f118ebb9a6dbe8c1 Mon Sep 17 00:00:00 2001 From: Ashley Date: Sat, 24 Dec 2022 10:48:55 +0000 Subject: [PATCH] remove yandere code :3 --- src/libpoketube/libpoketube-core.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/libpoketube/libpoketube-core.js b/src/libpoketube/libpoketube-core.js index c419de51..fa9ae306 100644 --- a/src/libpoketube/libpoketube-core.js +++ b/src/libpoketube/libpoketube-core.js @@ -37,14 +37,8 @@ function getJson(str) { } function checkUnexistingObject(obj) { - if (obj !== null) { - if (obj.authorId !== null) { - if (obj !== undefined) { - if (obj.authorId !== undefined) { - return true; - } - } - } + if (Object.hasOwn(obj, "authorId")) { + return true; } } @@ -86,19 +80,18 @@ async function video(v) { var vid = await getJson(video_new_info); if (checkUnexistingObject(vid)) { - var a; - + try { - var a = await fetch( - `${config.tubeApi}channel?id=${vid.authorId}&tab=about` - ) - .then((res) => res.text()) - .then((xml) => getJson(toJson(xml))); + var a = await fetch( + `${config.tubeApi}channel?id=${vid.authorId}&tab=about` + ) + .then((res) => res.text()) + .then((xml) => getJson(toJson(xml))); } catch { - var a = "" + var a = ""; } - + const summary = await wiki .summary(vid.author + " ") .then((summary_) =>