From fef5b95f61b1fd8538f79b524b5d32882434c590 Mon Sep 17 00:00:00 2001 From: Ashley Date: Thu, 31 Mar 2022 13:22:19 +0300 Subject: [PATCH] Update server.js --- server.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/server.js b/server.js index 4bf64e71..d8835ee2 100644 --- a/server.js +++ b/server.js @@ -45,18 +45,15 @@ const fetcher = require("./src/fetcher.js"); app.get("/watch", async function (req, res) { var v = req.query.v; var e = req.query.e; - var fetching = await fetcher(v) - const url = fetching.video.Player.Formats.Format[1].URL - /* + if(!v) res.redirect("/") + var fetching = await fetcher(v) const j = fetching.video.Player.Formats.Format, - j_ = typeof j === 'object' && j !== null - ? j - : j[j.length - 1]; + j_ = Array.isArray(j) + ? j[j.length - 1] + : j; let url; - if (j_.URL != undefined) url = j_.URL; - */ const json = fetching.video.Player const engagement = fetching.engagement const lyrics = await lyricsFinder(json.Title);