summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOmar Roth <omarroth@hotmail.com>2018-08-07 12:36:55 -0500
committerOmar Roth <omarroth@hotmail.com>2018-08-07 12:36:55 -0500
commitce506d39285c432564412f03f41b2454ed645737 (patch)
tree5cb6792843fa021c75a6686f1109f3f399b6f999 /src
parentcccf28aaf7cd199a5e9d8501b747c91c7f970e8b (diff)
downloadinvidious-ce506d39285c432564412f03f41b2454ed645737.tar.gz
invidious-ce506d39285c432564412f03f41b2454ed645737.tar.bz2
invidious-ce506d39285c432564412f03f41b2454ed645737.zip
Add 'hls' to video endpoint
Diffstat (limited to 'src')
-rw-r--r--src/invidious.cr12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/invidious.cr b/src/invidious.cr
index c1db9a6f..6a7561b4 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -1968,8 +1968,16 @@ get "/api/v1/videos/:id" do |env|
json.field "isListed", video.info["is_listed"] == "1"
end
- fmt_list = video.info["fmt_list"].split(",").map { |fmt| fmt.split("/")[1] }
- fmt_list = Hash.zip(fmt_list.map { |fmt| fmt[0] }, fmt_list.map { |fmt| fmt[1] })
+ if video.info["hlsvp"]?
+ 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.array do