diff options
| author | Omar Roth <omarroth@protonmail.com> | 2019-05-04 10:47:54 -0500 |
|---|---|---|
| committer | Omar Roth <omarroth@protonmail.com> | 2019-05-04 10:47:54 -0500 |
| commit | 0cf86974dd840137ac5202acc0919f5d0a8ff3c2 (patch) | |
| tree | 3f648c1f419a39e6665f1a57195703af1fe30e58 | |
| parent | 716705aa15878e74ca4f81f776bb66f7c08441f1 (diff) | |
| download | invidious-0cf86974dd840137ac5202acc0919f5d0a8ff3c2.tar.gz invidious-0cf86974dd840137ac5202acc0919f5d0a8ff3c2.tar.bz2 invidious-0cf86974dd840137ac5202acc0919f5d0a8ff3c2.zip | |
Add redirect for videos with no audio sources
| -rw-r--r-- | src/invidious.cr | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/invidious.cr b/src/invidious.cr index 0a891ba9..cf0d7c46 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -419,6 +419,12 @@ get "/watch" do |env| video_streams = video.video_streams(adaptive_fmts) audio_streams = video.audio_streams(adaptive_fmts) + # Older videos may not have audio sources available. + # We redirect here so they're not unplayable + if params.listen && audio_streams.empty? + next env.redirect "/watch?#{env.params.query}&listen=0" + end + captions = video.captions preferred_captions = captions.select { |caption| |
