Add new YT consent cookie to every request

This commit is contained in:
syeopite 2021-03-31 14:57:00 -07:00
parent 2c1cf42994
commit 739f610507
No known key found for this signature in database
GPG key ID: 6FA616E5A5294A82

View file

@ -9,6 +9,7 @@ def add_yt_headers(request)
return if request.resource.starts_with? "/sorry/index" return if request.resource.starts_with? "/sorry/index"
request.headers["x-youtube-client-name"] ||= "1" request.headers["x-youtube-client-name"] ||= "1"
request.headers["x-youtube-client-version"] ||= "2.20200609" request.headers["x-youtube-client-version"] ||= "2.20200609"
request.headers["cookie"] = "CONSENT=YES+cb.20210328-17-p0.en; " # New YT consent cookie for EU servers
if !CONFIG.cookies.empty? if !CONFIG.cookies.empty?
request.headers["cookie"] = "#{(CONFIG.cookies.map { |c| "#{c.name}=#{c.value}" }).join("; ")}; #{request.headers["cookie"]?}" request.headers["cookie"] = "#{(CONFIG.cookies.map { |c| "#{c.name}=#{c.value}" }).join("; ")}; #{request.headers["cookie"]?}"
end end