mirror of
https://github.com/iv-org/invidious.git
synced 2025-12-17 09:23:54 -05:00
Merge 189e6aab11 into ef2290c1fd
This commit is contained in:
commit
58cd42eb64
1 changed files with 5 additions and 2 deletions
|
|
@ -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?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue