Compare commits
2 commits
3bb7924181
...
4a8fffac26
Author | SHA1 | Date | |
---|---|---|---|
4a8fffac26 | |||
ebd89acf79 |
1 changed files with 18 additions and 8 deletions
|
@ -186,9 +186,8 @@ module Invidious::Routes::API::Manifest
|
||||||
manifest = response.body
|
manifest = response.body
|
||||||
|
|
||||||
if local
|
if local
|
||||||
manifest = manifest.gsub(/^https:\/\/[^\n"]*/m) do |match|
|
manifest = manifest.gsub(/^https:\/\/\w+---.{11}\.c\.youtube\.com[^\n]*/m) do |match|
|
||||||
uri = URI.parse(match)
|
path = URI.parse(match).path
|
||||||
path = uri.path
|
|
||||||
|
|
||||||
path = path.lchop("/videoplayback/")
|
path = path.lchop("/videoplayback/")
|
||||||
path = path.rchop("/")
|
path = path.rchop("/")
|
||||||
|
@ -217,14 +216,20 @@ module Invidious::Routes::API::Manifest
|
||||||
raw_params["fvip"] = fvip["fvip"]
|
raw_params["fvip"] = fvip["fvip"]
|
||||||
end
|
end
|
||||||
|
|
||||||
raw_params["host"] = uri.host.not_nil!
|
raw_params["local"] = "true"
|
||||||
|
|
||||||
proxy = Invidious::HttpServer::Utils.get_external_proxy
|
proxy = Invidious::HttpServer::Utils.get_external_proxy
|
||||||
|
|
||||||
if !proxy.empty?
|
if CONFIG.https_only
|
||||||
"#{proxy}/videoplayback?#{raw_params}"
|
scheme = "https://"
|
||||||
else
|
else
|
||||||
"#{env.request.headers["Host"]}/videoplayback?#{raw_params}"
|
scheme = "http://"
|
||||||
|
end
|
||||||
|
|
||||||
|
if !proxy.empty?
|
||||||
|
"#{scheme}#{proxy}/videoplayback?#{raw_params}"
|
||||||
|
else
|
||||||
|
"#{scheme}#{env.request.headers["Host"]}/videoplayback?#{raw_params}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -248,7 +253,12 @@ module Invidious::Routes::API::Manifest
|
||||||
manifest = response.body
|
manifest = response.body
|
||||||
|
|
||||||
if local
|
if local
|
||||||
manifest = manifest.gsub("https://www.youtube.com", env.request.headers["Host"])
|
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("index.m3u8", "index.m3u8?local=true")
|
manifest = manifest.gsub("index.m3u8", "index.m3u8?local=true")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue