From ab96d0fa342f189f606d6d22d0446daaed7b00b7 Mon Sep 17 00:00:00 2001 From: ashley Date: Sun, 5 May 2024 12:57:16 +0000 Subject: [PATCH] fix video search --- src/libpoketube/init/pages-channel-and-download.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libpoketube/init/pages-channel-and-download.js b/src/libpoketube/init/pages-channel-and-download.js index 0080a051..a10f73b6 100644 --- a/src/libpoketube/init/pages-channel-and-download.js +++ b/src/libpoketube/init/pages-channel-and-download.js @@ -110,9 +110,11 @@ module.exports = function (app, config, renderTemplate) { if (query) { let redirectTo = null; + let splitParam = ":"; if (query.includes("youtube.com/watch?v=")) { - redirectTo = "/watch?v="; + redirectTo = "/watch"; + splitParam = "?v="; } else if (query.includes("channel:")) { redirectTo = "/channel?id="; } else if (query.includes("video:")) { @@ -121,8 +123,8 @@ module.exports = function (app, config, renderTemplate) { if (redirectTo) { try { - const id = query.split(":")[1]; - res.redirect(`${redirectTo}${id}`); + const id = query.split(splitParam)[1]; + res.redirect(`${redirectTo}${splitParam}${id}`); } catch { return; }