|
|
@ -694,7 +694,9 @@ post "/login" do |env|
|
|
|
|
|
|
|
|
|
|
|
|
challenge_req = {
|
|
|
|
challenge_req = {
|
|
|
|
user_hash, nil, 1, nil,
|
|
|
|
user_hash, nil, 1, nil,
|
|
|
|
{1, nil, nil, nil, {password, nil, true}},
|
|
|
|
{1, nil, nil, nil,
|
|
|
|
|
|
|
|
{password, nil, true},
|
|
|
|
|
|
|
|
},
|
|
|
|
{nil, nil,
|
|
|
|
{nil, nil,
|
|
|
|
{2, 1, nil, 1, "https://accounts.google.com/ServiceLogin?passive=1209600&continue=https%3A%2F%2Faccounts.google.com%2FManageAccount&followup=https%3A%2F%2Faccounts.google.com%2FManageAccount", nil, [] of String, 4, [] of String},
|
|
|
|
{2, 1, nil, 1, "https://accounts.google.com/ServiceLogin?passive=1209600&continue=https%3A%2F%2Faccounts.google.com%2FManageAccount&followup=https%3A%2F%2Faccounts.google.com%2FManageAccount", nil, [] of String, 4, [] of String},
|
|
|
|
1,
|
|
|
|
1,
|
|
|
@ -3342,45 +3344,24 @@ get "/videoplayback" do |env|
|
|
|
|
host = "https://r#{fvip}---#{mn}.googlevideo.com"
|
|
|
|
host = "https://r#{fvip}---#{mn}.googlevideo.com"
|
|
|
|
url = "/videoplayback?#{query_params.to_s}"
|
|
|
|
url = "/videoplayback?#{query_params.to_s}"
|
|
|
|
|
|
|
|
|
|
|
|
if query_params["region"]?
|
|
|
|
region = query_params["region"]?
|
|
|
|
client = make_client(URI.parse(host))
|
|
|
|
client = make_client(URI.parse(host), proxies, region)
|
|
|
|
response = HTTP::Client::Response.new(status_code: 403)
|
|
|
|
response = client.head(url)
|
|
|
|
|
|
|
|
|
|
|
|
if !proxies[query_params["region"]]?
|
|
|
|
if response.headers["Location"]?
|
|
|
|
halt env, status_code: 403
|
|
|
|
url = URI.parse(response.headers["Location"])
|
|
|
|
end
|
|
|
|
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
|
|
|
|
|
|
|
|
|
|
|
proxies[query_params["region"]].each do |proxy|
|
|
|
|
url = url.full_path
|
|
|
|
begin
|
|
|
|
if region
|
|
|
|
client = HTTPClient.new(URI.parse(host))
|
|
|
|
url += "®ion=#{region}"
|
|
|
|
client.read_timeout = 10.seconds
|
|
|
|
|
|
|
|
client.connect_timeout = 10.seconds
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
proxy = HTTPProxy.new(proxy_host: proxy[:ip], proxy_port: proxy[:port])
|
|
|
|
|
|
|
|
client.set_proxy(proxy)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
response = client.head(url)
|
|
|
|
|
|
|
|
if response.status_code == 200
|
|
|
|
|
|
|
|
# For whatever reason the proxy needs to be set again
|
|
|
|
|
|
|
|
client.set_proxy(proxy)
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
rescue ex
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
|
|
|
|
client = make_client(URI.parse(host))
|
|
|
|
|
|
|
|
response = client.head(url)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if response.status_code != 200
|
|
|
|
next env.redirect url
|
|
|
|
halt env, status_code: 403
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if response.headers["Location"]?
|
|
|
|
if response.status_code >= 400
|
|
|
|
url = URI.parse(response.headers["Location"])
|
|
|
|
halt env, status_code: 403
|
|
|
|
env.response.headers["Access-Control-Allow-Origin"] = "*"
|
|
|
|
|
|
|
|
next env.redirect url.full_path
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
headers = env.request.headers
|
|
|
|
headers = env.request.headers
|
|
|
@ -3389,6 +3370,7 @@ get "/videoplayback" do |env|
|
|
|
|
headers.delete("User-Agent")
|
|
|
|
headers.delete("User-Agent")
|
|
|
|
headers.delete("Referer")
|
|
|
|
headers.delete("Referer")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
client = make_client(URI.parse(host), proxies, region)
|
|
|
|
client.get(url, headers) do |response|
|
|
|
|
client.get(url, headers) do |response|
|
|
|
|
env.response.status_code = response.status_code
|
|
|
|
env.response.status_code = response.status_code
|
|
|
|
|
|
|
|
|
|
|
|