mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Add 'hls' to video endpoint
This commit is contained in:
parent
cccf28aaf7
commit
ce506d3928
1 changed files with 10 additions and 2 deletions
|
@ -1968,8 +1968,16 @@ get "/api/v1/videos/:id" do |env|
|
||||||
json.field "isListed", video.info["is_listed"] == "1"
|
json.field "isListed", video.info["is_listed"] == "1"
|
||||||
end
|
end
|
||||||
|
|
||||||
fmt_list = video.info["fmt_list"].split(",").map { |fmt| fmt.split("/")[1] }
|
if video.info["hlsvp"]?
|
||||||
fmt_list = Hash.zip(fmt_list.map { |fmt| fmt[0] }, fmt_list.map { |fmt| fmt[1] })
|
host_url = make_host_url(Kemal.config.ssl || CONFIG.https_only, env.request.headers["Host"]?)
|
||||||
|
host_params = env.request.query_params
|
||||||
|
host_params.delete_all("v")
|
||||||
|
|
||||||
|
hlsvp = video.info["hlsvp"]
|
||||||
|
hlsvp = hlsvp.gsub("https://manifest.googlevideo.com", host_url)
|
||||||
|
|
||||||
|
json.field "hls", hlsvp
|
||||||
|
end
|
||||||
|
|
||||||
json.field "adaptiveFormats" do
|
json.field "adaptiveFormats" do
|
||||||
json.array do
|
json.array do
|
||||||
|
|
Loading…
Reference in a new issue