mirror of
https://github.com/iv-org/invidious.git
synced 2024-10-01 01:25:56 -04:00
Add better fallback for '/videoplayback'
This commit is contained in:
parent
58f4212aa8
commit
1fcd1ff3e8
@ -4217,13 +4217,14 @@ end
|
|||||||
get "/videoplayback" do |env|
|
get "/videoplayback" do |env|
|
||||||
query_params = env.params.query
|
query_params = env.params.query
|
||||||
|
|
||||||
|
fvip = query_params["fvip"]? || "3"
|
||||||
|
mns = query_params["mn"].split(",")
|
||||||
|
|
||||||
if query_params["host"]? && !query_params["host"].empty?
|
if query_params["host"]? && !query_params["host"].empty?
|
||||||
host = "https://#{query_params["host"]}"
|
host = "https://#{query_params["host"]}"
|
||||||
query_params.delete("host")
|
query_params.delete("host")
|
||||||
else
|
else
|
||||||
fvip = query_params["fvip"]? || "3"
|
host = "https://r#{fvip}---#{mns.pop}.googlevideo.com"
|
||||||
mn = query_params["mn"].split(",").pop
|
|
||||||
host = "https://r#{fvip}---#{mn}.googlevideo.com"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
url = "/videoplayback?#{query_params.to_s}"
|
url = "/videoplayback?#{query_params.to_s}"
|
||||||
@ -4244,11 +4245,11 @@ get "/videoplayback" do |env|
|
|||||||
response = client.head(url, headers)
|
response = client.head(url, headers)
|
||||||
break
|
break
|
||||||
rescue Socket::Addrinfo::Error
|
rescue Socket::Addrinfo::Error
|
||||||
if fvip == "3"
|
if !mns.empty?
|
||||||
break
|
mn = mns.pop
|
||||||
end
|
end
|
||||||
|
|
||||||
fvip = "3"
|
fvip = "3"
|
||||||
|
|
||||||
host = "https://r#{fvip}---#{mn}.googlevideo.com"
|
host = "https://r#{fvip}---#{mn}.googlevideo.com"
|
||||||
rescue ex
|
rescue ex
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user