From 2a04a48b891835ce3d68ff883c7b88a6b2e37508 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Sun, 20 Oct 2019 12:48:11 -0400 Subject: [PATCH] Fix redirect for livestreams --- src/invidious.cr | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 8cb1cedf..215619af 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -489,7 +489,7 @@ get "/watch" do |env| # Older videos may not have audio sources available. # We redirect here so they're not unplayable - if audio_streams.empty? + if audio_streams.empty? && !video.live_now if params.quality == "dash" env.params.query.delete_all("quality") env.params.query["quality"] = "medium" @@ -729,14 +729,14 @@ get "/embed/:id" do |env| video_streams = video.video_streams(adaptive_fmts) audio_streams = video.audio_streams(adaptive_fmts) - if audio_streams.empty? + if audio_streams.empty? && !video.live_now if params.quality == "dash" env.params.query.delete_all("quality") - next env.redirect "/embed/#{video_id}?#{env.params.query}" + next env.redirect "/embed/#{id}?#{env.params.query}" elsif params.listen env.params.query.delete_all("listen") env.params.query["listen"] = "0" - next env.redirect "/embed/#{video_id}?#{env.params.query}" + next env.redirect "/embed/#{id}?#{env.params.query}" end end