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
|
||||
|
||||
if local
|
||||
manifest = manifest.gsub(/^https:\/\/[^\n"]*/m) do |match|
|
||||
uri = URI.parse(match)
|
||||
path = uri.path
|
||||
manifest = manifest.gsub(/^https:\/\/\w+---.{11}\.c\.youtube\.com[^\n]*/m) do |match|
|
||||
path = URI.parse(match).path
|
||||
|
||||
path = path.lchop("/videoplayback/")
|
||||
path = path.rchop("/")
|
||||
|
@ -217,14 +216,20 @@ module Invidious::Routes::API::Manifest
|
|||
raw_params["fvip"] = fvip["fvip"]
|
||||
end
|
||||
|
||||
raw_params["host"] = uri.host.not_nil!
|
||||
raw_params["local"] = "true"
|
||||
|
||||
proxy = Invidious::HttpServer::Utils.get_external_proxy
|
||||
|
||||
if !proxy.empty?
|
||||
"#{proxy}/videoplayback?#{raw_params}"
|
||||
if CONFIG.https_only
|
||||
scheme = "https://"
|
||||
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
|
||||
|
@ -248,7 +253,12 @@ module Invidious::Routes::API::Manifest
|
|||
manifest = response.body
|
||||
|
||||
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")
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue