Compare commits

..

No commits in common. "4a8fffac26530eeac31748c135146836fa6d1ad2" and "3bb792418173d0b8a150ee919f9efc82516b3268" have entirely different histories.

View file

@ -186,8 +186,9 @@ module Invidious::Routes::API::Manifest
manifest = response.body
if local
manifest = manifest.gsub(/^https:\/\/\w+---.{11}\.c\.youtube\.com[^\n]*/m) do |match|
path = URI.parse(match).path
manifest = manifest.gsub(/^https:\/\/[^\n"]*/m) do |match|
uri = URI.parse(match)
path = uri.path
path = path.lchop("/videoplayback/")
path = path.rchop("/")
@ -216,20 +217,14 @@ module Invidious::Routes::API::Manifest
raw_params["fvip"] = fvip["fvip"]
end
raw_params["local"] = "true"
raw_params["host"] = uri.host.not_nil!
proxy = Invidious::HttpServer::Utils.get_external_proxy
if CONFIG.https_only
scheme = "https://"
else
scheme = "http://"
end
if !proxy.empty?
"#{scheme}#{proxy}/videoplayback?#{raw_params}"
"#{proxy}/videoplayback?#{raw_params}"
else
"#{scheme}#{env.request.headers["Host"]}/videoplayback?#{raw_params}"
"#{env.request.headers["Host"]}/videoplayback?#{raw_params}"
end
end
end
@ -253,12 +248,7 @@ module Invidious::Routes::API::Manifest
manifest = response.body
if local
if CONFIG.https_only
scheme = "https://"
else
scheme = "http://"
end
manifest = manifest.gsub("https://www.youtube.com", "#{scheme}#{env.request.headers["Host"]}")
manifest = manifest.gsub("https://www.youtube.com", env.request.headers["Host"])
manifest = manifest.gsub("index.m3u8", "index.m3u8?local=true")
end