Fix named arg syntax when passing force_resolve
This commit is contained in:
parent
73ec78dfe2
commit
53c4ffbdf3
2 changed files with 6 additions and 10 deletions
|
@ -47,11 +47,7 @@ module Invidious::Routes::VideoPlayback
|
||||||
headers["Range"] = "bytes=#{range_for_head}"
|
headers["Range"] = "bytes=#{range_for_head}"
|
||||||
end
|
end
|
||||||
|
|
||||||
headers["Origin"] = "https://www.youtube.com"
|
client = make_client(URI.parse(host), region, force_resolve: true)
|
||||||
headers["Referer"] = "https://www.youtube.com/"
|
|
||||||
headers["User-Agent"] = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
|
|
||||||
|
|
||||||
client = make_client(URI.parse(host), region, force_resolve = true)
|
|
||||||
response = HTTP::Client::Response.new(500)
|
response = HTTP::Client::Response.new(500)
|
||||||
error = ""
|
error = ""
|
||||||
5.times do
|
5.times do
|
||||||
|
@ -66,7 +62,7 @@ module Invidious::Routes::VideoPlayback
|
||||||
if new_host != host
|
if new_host != host
|
||||||
host = new_host
|
host = new_host
|
||||||
client.close
|
client.close
|
||||||
client = make_client(URI.parse(new_host), region, force_resolve = true)
|
client = make_client(URI.parse(new_host), region, force_resolve: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
url = "#{location.request_target}&host=#{location.host}#{region ? "®ion=#{region}" : ""}"
|
url = "#{location.request_target}&host=#{location.host}#{region ? "®ion=#{region}" : ""}"
|
||||||
|
@ -80,7 +76,7 @@ module Invidious::Routes::VideoPlayback
|
||||||
fvip = "3"
|
fvip = "3"
|
||||||
|
|
||||||
host = "https://r#{fvip}---#{mn}.googlevideo.com"
|
host = "https://r#{fvip}---#{mn}.googlevideo.com"
|
||||||
client = make_client(URI.parse(host), region, force_resolve = true)
|
client = make_client(URI.parse(host), region, force_resolve: true)
|
||||||
rescue ex
|
rescue ex
|
||||||
error = ex.message
|
error = ex.message
|
||||||
end
|
end
|
||||||
|
@ -205,7 +201,7 @@ module Invidious::Routes::VideoPlayback
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
client.close
|
client.close
|
||||||
client = make_client(URI.parse(host), region, force_resolve = true)
|
client = make_client(URI.parse(host), region, force_resolve: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,8 @@ def make_client(url : URI, region = nil, force_resolve : Bool = false)
|
||||||
return client
|
return client
|
||||||
end
|
end
|
||||||
|
|
||||||
def make_client(url : URI, region = nil, force_resolve : Bool = false, &)
|
def make_client(url : URI, region = nil, force_resolve : Bool = false, &block)
|
||||||
client = make_client(url, region, force_resolve)
|
client = make_client(url, region, force_resolve: force_resolve)
|
||||||
begin
|
begin
|
||||||
yield client
|
yield client
|
||||||
ensure
|
ensure
|
||||||
|
|
Loading…
Add table
Reference in a new issue