From e702e588fcd2bf52f8d1d7d546ac3c53ddbe735b 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);