Merge 189e6aab118a115ce3a8265276526c8c216dea88 into 749791cdf1316bc89415d27d503042d3f6b3f398

This commit is contained in:
Theo Luis Fischer 2026-03-10 10:38:01 +01:00 committed by GitHub
commit ee53980fc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9,10 +9,13 @@ module Invidious::Routes::ErrorRoutes
item = md["id"]
# Check if item is branding URL e.g. https://youtube.com/gaming
response = YT_POOL.client &.get("/#{item}")
# 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)
response = YT_POOL.client &.get(URI.parse(response.headers["Location"]).request_target, headers: headers)
end
if response.body.empty?