mirror of
https://github.com/iv-org/invidious.git
synced 2025-08-14 08:38:30 +00:00
Don't send invidious URL params in brand_redirect
This commit is contained in:
parent
9962964f48
commit
bf6b9a0b86
@ -105,8 +105,17 @@ class Invidious::Routes::Channels < Invidious::Routes::BaseRoute
|
|||||||
def brand_redirect(env)
|
def brand_redirect(env)
|
||||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||||
|
|
||||||
|
# /profile endpoint uses the `user` parameter
|
||||||
|
# /attribution_link endpoint needs both the `a` and `u` parameter
|
||||||
|
# and in order to avoid detection from YouTube we should only send the required ones
|
||||||
|
# without any of the additional url parameters that only Invidious uses.
|
||||||
|
yt_url_params = URI::Params.encode(env.params.query.to_h.select(["a", "u", "user"]))
|
||||||
|
|
||||||
|
# Retrieves URL params that only Invidious uses
|
||||||
|
invidious_url_params = URI::Params.encode(env.params.query.to_h.select!(["a", "u", "user"]))
|
||||||
|
|
||||||
begin
|
begin
|
||||||
resolved_url = YoutubeAPI.resolve_url("https://youtube.com#{env.request.path}#{env.params.query.size > 0 ? "?#{env.params.query}" : ""}")
|
resolved_url = YoutubeAPI.resolve_url("https://youtube.com#{env.request.path}#{yt_url_params.size > 0 ? "?#{yt_url_params}" : ""}")
|
||||||
rescue ex : InfoException
|
rescue ex : InfoException
|
||||||
raise InfoException.new("This channel does not exist.")
|
raise InfoException.new("This channel does not exist.")
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user