From ce9ed2c4a3d52012614d92cd032cc5a31cf1cd1c Mon Sep 17 00:00:00 2001 From: Ashley Date: Sat, 7 Jan 2023 13:38:36 +0000 Subject: [PATCH] use in ... data :p --- src/libpoketube/init/pages-video.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libpoketube/init/pages-video.js b/src/libpoketube/init/pages-video.js index a0bd31fb..c2d06c01 100644 --- a/src/libpoketube/init/pages-video.js +++ b/src/libpoketube/init/pages-video.js @@ -108,6 +108,14 @@ function IsInArray(array, id) { return false; } +function getJson(str) { + try { + return JSON.parse(str); + } catch { + return false; + } +} + module.exports = function (app, config, renderTemplate) { app.get("/encryption", async function (req, res) { var v = req.query.v; @@ -194,7 +202,7 @@ module.exports = function (app, config, renderTemplate) { if (isvld) { core.video(v).then((data) => { if (data) { - if ("video" in data) { + if ("video" in getJson(data)) { const k = data.video; const json = data.json; const engagement = data.engagement;