diff options
| author | Omar Roth <omarroth@hotmail.com> | 2018-05-29 18:40:36 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@hotmail.com> | 2018-05-29 18:40:36 -0500 |
| commit | 61cd13578089eb812ca06e1bb41403f45aa94a0c (patch) | |
| tree | 547c321df777f7fa074197cd78258d943884a43d | |
| parent | f79825fc80810e803d4b8401d3bd27f7457d4b9e (diff) | |
| download | invidious-61cd13578089eb812ca06e1bb41403f45aa94a0c.tar.gz invidious-61cd13578089eb812ca06e1bb41403f45aa94a0c.tar.bz2 invidious-61cd13578089eb812ca06e1bb41403f45aa94a0c.zip | |
Use local links for video playback
| -rw-r--r-- | src/invidious.cr | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 7ed2f194..917928e2 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -281,6 +281,12 @@ get "/watch" do |env| end end + fmt_stream.each { |s| s.add("label", "#{s["quality"]} - #{s["type"].split(";")[0].split("/")[1]}") } + fmt_stream = fmt_stream.uniq { |s| s["label"] } + fmt_stream.each do |stream| + stream["url"] = URI.parse(stream["url"]).full_path + end + adaptive_fmts = [] of HTTP::Params if video.info.has_key?("adaptive_fmts") video.info["adaptive_fmts"].split(",") do |string| @@ -298,16 +304,11 @@ get "/watch" do |env| end end - fmt_stream.each { |s| s.add("label", "#{s["quality"]} - #{s["type"].split(";")[0].split("/")[1]}") } - fmt_stream = fmt_stream.uniq { |s| s["label"] } - - video_streams = adaptive_fmts.compact_map { |s| s["type"].starts_with?("video") ? s : nil } - video_streams = video_streams.uniq { |s| s["size"] } - audio_streams = adaptive_fmts.compact_map { |s| s["type"].starts_with?("audio") ? s : nil } audio_streams.sort_by! { |s| s["bitrate"].to_i }.reverse! - audio_streams.each do |fmt| - fmt["bitrate"] = (fmt["bitrate"].to_f64/1000).to_i.to_s + audio_streams.each do |stream| + stream["bitrate"] = (stream["bitrate"].to_f64/1000).to_i.to_s + stream["url"] = URI.parse(stream["url"]).full_path end rvs = [] of Hash(String, String) |
