mirror of
https://github.com/iv-org/invidious.git
synced 2025-12-03 20:38:29 -06:00
Merge 189e6aab118a115ce3a8265276526c8c216dea88 into 35d1d499bc42a9b141b3dc92c4a5827b5f21a3ff
This commit is contained in:
commit
d8a915c44a
@ -9,10 +9,13 @@ module Invidious::Routes::ErrorRoutes
|
|||||||
item = md["id"]
|
item = md["id"]
|
||||||
|
|
||||||
# Check if item is branding URL e.g. https://youtube.com/gaming
|
# 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
|
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
|
end
|
||||||
|
|
||||||
if response.body.empty?
|
if response.body.empty?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user