make_client: add YouTube headers on *.youtube.com

This commit is contained in:
syeopite 2024-08-24 19:41:39 -07:00 committed by Fijxu
parent 82bd79bb0f
commit 6078232bbe
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

View file

@ -47,7 +47,7 @@ def make_client(url : URI, region = nil, force_resolve : Bool = false, force_you
client.family = Socket::Family::INET if client.family == Socket::Family::UNSPEC
end
client.before_request { |r| add_yt_headers(r) } if url.host == "www.youtube.com" || force_youtube_headers
client.before_request { |r| add_yt_headers(r) } if url.host.try &.ends_with?("youtube.com") || force_youtube_headers
client.read_timeout = 10.seconds
client.connect_timeout = 10.seconds