Fix redirected youtu.be/ID shortlinks parameters ordering
Previouly, /[ID]?autoplay=1&test1&test2 would redirect to /watch?autoplay=1&test1=&test2=&v=[ID] which is kind of ugly, and not how YouTube redirects youtu.be shortlinks. This is now redirecting to /watch?v=[ID]&autoplay=1&test1=&test2
This commit is contained in:
parent
6f8eb43e24
commit
4332d3043f
|
@ -4,9 +4,7 @@ const {redirect} = require("pinski/plugins")
|
|||
module.exports = [
|
||||
{
|
||||
route: `/(${constants.regex.video_id})`, priority: -1, methods: ["GET"], code: async ({fill, url}) => {
|
||||
const target = new URLSearchParams(url.search)
|
||||
target.set("v", fill[0])
|
||||
return redirect(`/watch?${target}`, 301)
|
||||
return redirect(`/watch?v=${fill[0]}${url.search.replace(/^\?/, "&")}`, 301)
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue