mirror of
				https://github.com/iv-org/invidious.git
				synced 2025-11-04 14:41:59 +00:00 
			
		
		
		
	Add 'host' to '/videoplayback'
This commit is contained in:
		@@ -4217,9 +4217,15 @@ end
 | 
			
		||||
get "/videoplayback" do |env|
 | 
			
		||||
  query_params = env.params.query
 | 
			
		||||
 | 
			
		||||
  fvip = query_params["fvip"]? || "3"
 | 
			
		||||
  mn = query_params["mn"].split(",").pop
 | 
			
		||||
  host = "https://r#{fvip}---#{mn}.googlevideo.com"
 | 
			
		||||
  if query_params["host"]? && !query_params["host"].empty?
 | 
			
		||||
    pp query_params["host"]
 | 
			
		||||
    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}"
 | 
			
		||||
 | 
			
		||||
  headers = HTTP::Headers.new
 | 
			
		||||
 
 | 
			
		||||
@@ -317,6 +317,7 @@ class Video
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    streams.each do |fmt|
 | 
			
		||||
      fmt["url"] += "&host=" + (URI.parse(fmt["url"]).host || "")
 | 
			
		||||
      fmt["url"] += decrypt_signature(fmt, decrypt_function)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@@ -384,6 +385,7 @@ class Video
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    adaptive_fmts.each do |fmt|
 | 
			
		||||
      fmt["url"] += "&host=" + (URI.parse(fmt["url"]).host || "")
 | 
			
		||||
      fmt["url"] += decrypt_signature(fmt, decrypt_function)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user