diff --git a/src/invidious/routes/errors.cr b/src/invidious/routes/errors.cr index 2ac6b436..03b4ac0f 100644 --- a/src/invidious/routes/errors.cr +++ b/src/invidious/routes/errors.cr @@ -9,9 +9,10 @@ module Invidious::Routes::ErrorRoutes item = md["id"] # Check if item is branding URL e.g. https://youtube.com/gaming - headers = HTTP::Headers{ - "Cookie" => "SOCS=CAE" # Cookies to prevent redirects to Cookie Consent Page CAE~Reject all, CAA~showing the cookie banner, CAI~Accept all - } + # Cookie to prevent redirects to the cookie consent page. + # Cookie values: CAE = Reject all, CAA = show the cookie banner, CAI = Accept all + headers = HTTP::Headers{"Cookie" => "SOCS=CAE"} + response = YT_POOL.client &.get("/#{item}", headers: headers) if response.status_code == 301 response = YT_POOL.client &.get(URI.parse(response.headers["Location"]).request_target, headers: headers)