Add 'host' to '/videoplayback'

pull/411/head
Omar Roth 2019-03-11 13:14:30 -05:00
rodzic 11ff40bcd6
commit f01152eda1
2 zmienionych plików z 11 dodań i 3 usunięć

Wyświetl plik

@ -4217,9 +4217,15 @@ end
get "/videoplayback" do |env| get "/videoplayback" do |env|
query_params = env.params.query query_params = env.params.query
fvip = query_params["fvip"]? || "3" if query_params["host"]? && !query_params["host"].empty?
mn = query_params["mn"].split(",").pop pp query_params["host"]
host = "https://r#{fvip}---#{mn}.googlevideo.com" host = "https://#{query_params["host"]}"
else
fvip = query_params["fvip"]? || "3"
mn = query_params["mn"].split(",").pop
host = "https://r#{fvip}---#{mn}.googlevideo.com"
end
url = "/videoplayback?#{query_params.to_s}" url = "/videoplayback?#{query_params.to_s}"
headers = HTTP::Headers.new headers = HTTP::Headers.new

Wyświetl plik

@ -317,6 +317,7 @@ class Video
end end
streams.each do |fmt| streams.each do |fmt|
fmt["url"] += "&host=" + (URI.parse(fmt["url"]).host || "")
fmt["url"] += decrypt_signature(fmt, decrypt_function) fmt["url"] += decrypt_signature(fmt, decrypt_function)
end end
@ -384,6 +385,7 @@ class Video
end end
adaptive_fmts.each do |fmt| adaptive_fmts.each do |fmt|
fmt["url"] += "&host=" + (URI.parse(fmt["url"]).host || "")
fmt["url"] += decrypt_signature(fmt, decrypt_function) fmt["url"] += decrypt_signature(fmt, decrypt_function)
end end