fix video search

This commit is contained in:
ashley 2024-05-05 12:57:16 +00:00
parent ae935825f4
commit ab96d0fa34

View file

@ -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;
}