From 517f67958c981b3a5d298c4ecd2b01b7fe4415b4 Mon Sep 17 00:00:00 2001 From: Ashley Date: Sun, 26 Mar 2023 12:30:07 +0000 Subject: [PATCH] add try catch :p --- src/libpoketube/init/pages-channel-and-download.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libpoketube/init/pages-channel-and-download.js b/src/libpoketube/init/pages-channel-and-download.js index e41718e4..1a007c44 100644 --- a/src/libpoketube/init/pages-channel-and-download.js +++ b/src/libpoketube/init/pages-channel-and-download.js @@ -30,6 +30,7 @@ function getJson(str) { module.exports = function (app, config, renderTemplate) { app.get("/download", async function (req, res) { + try { var v = req.query.v; // video @@ -53,6 +54,9 @@ module.exports = function (app, config, renderTemplate) { .getColors(`https://i.ytimg.com/vi/${v}/maxresdefault.jpg`) .then((colors) => colors[0].hex()), }); + } catch { + res.redirect("/") + } }); app.get("/old/watch", async function (req, res) {