mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 09:38:25 +01:00
fix video search
This commit is contained in:
parent
ae935825f4
commit
ab96d0fa34
1 changed files with 5 additions and 3 deletions
|
@ -110,9 +110,11 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
|
|
||||||
if (query) {
|
if (query) {
|
||||||
let redirectTo = null;
|
let redirectTo = null;
|
||||||
|
let splitParam = ":";
|
||||||
|
|
||||||
if (query.includes("youtube.com/watch?v=")) {
|
if (query.includes("youtube.com/watch?v=")) {
|
||||||
redirectTo = "/watch?v=";
|
redirectTo = "/watch";
|
||||||
|
splitParam = "?v=";
|
||||||
} else if (query.includes("channel:")) {
|
} else if (query.includes("channel:")) {
|
||||||
redirectTo = "/channel?id=";
|
redirectTo = "/channel?id=";
|
||||||
} else if (query.includes("video:")) {
|
} else if (query.includes("video:")) {
|
||||||
|
@ -121,8 +123,8 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
|
|
||||||
if (redirectTo) {
|
if (redirectTo) {
|
||||||
try {
|
try {
|
||||||
const id = query.split(":")[1];
|
const id = query.split(splitParam)[1];
|
||||||
res.redirect(`${redirectTo}${id}`);
|
res.redirect(`${redirectTo}${splitParam}${id}`);
|
||||||
} catch {
|
} catch {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue