diff --git a/src/libpoketube/init/pages-video.js b/src/libpoketube/init/pages-video.js
index 40b44d70..557714a9 100644
--- a/src/libpoketube/init/pages-video.js
+++ b/src/libpoketube/init/pages-video.js
@@ -175,61 +175,66 @@ module.exports = function (app, config, renderTemplate) {
const engagement = data.engagement;
var inv_comments = data.comments;
const inv_vid = data.vid;
+ //checks if json exists
- if ("Title" in json) {
- if (!data.comments) inv_comments = "Disabled";
+ if (json) {
+ //checks if title exists in the json object
- if (!core.video(v).b) {
- var nnn = "";
- var badges = "";
- var comments = "";
+ if ("Title" in json) {
+ if (!data.comments) inv_comments = "Disabled";
+
+ if (!core.video(v).b) {
+ var nnn = "";
+ var badges = "";
+ var comments = "";
+ }
+
+ if (!v) res.redirect("/");
+
+ if (q === "medium") {
+ var url = `https://inv.vern.cc/latest_version?id=${v}&itag=18&local=true`;
+ }
+
+ const desc = data.desc;
+
+ if (d) {
+ var d = desc.toString().replace(/\n/g, "
");
+ }
+
+ if (d === "[object Object]") {
+ var d = false;
+ }
+
+ renderTemplate(res, req, "poketube.ejs", {
+ color: data.color,
+ color2: data.color2,
+ engagement: engagement,
+ video: json,
+ date: k.Video.uploadDate,
+ e: e,
+ k: k,
+ process: process,
+ sha384: sha384,
+ lightOrDark,
+ isMobile: req.useragent.isMobile,
+ tj: data.channel,
+ r: r,
+ qua: q,
+ inv: inv_comments,
+ ip: ip,
+ convert: convert,
+ wiki: data.wiki,
+ f: f,
+ t: config.t_url,
+ optout: t,
+ badges: badges,
+ desc: desc,
+ comments: comments,
+ n: nnn,
+ inv_vid,
+ lyrics: "",
+ });
}
-
- if (!v) res.redirect("/");
-
- if (q === "medium") {
- var url = `https://inv.vern.cc/latest_version?id=${v}&itag=18&local=true`;
- }
-
- const desc = data.desc;
-
- if (d) {
- var d = desc.toString().replace(/\n/g, "
");
- }
-
- if (d === "[object Object]") {
- var d = false;
- }
-
- renderTemplate(res, req, "poketube.ejs", {
- color: data.color,
- color2: data.color2,
- engagement: engagement,
- video: json,
- date: k.Video.uploadDate,
- e: e,
- k: k,
- process: process,
- sha384: sha384,
- lightOrDark,
- isMobile: req.useragent.isMobile,
- tj: data.channel,
- r: r,
- qua: q,
- inv: inv_comments,
- ip: ip,
- convert: convert,
- wiki: data.wiki,
- f: f,
- t: config.t_url,
- optout: t,
- badges: badges,
- desc: desc,
- comments: comments,
- n: nnn,
- inv_vid,
- lyrics: "",
- });
}
}
} else {