From 7b662b008cd7f592d061e5ddcbf205fe95a0f3d0 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Wed, 30 Oct 2024 13:14:54 -0300 Subject: [PATCH] Videos: Fix audio tracks language. Video will only return the default language. The rest of the audio tracks are deleted since they will not be used. --- src/invidious/routes/api/manifest.cr | 4 ++++ src/invidious/routes/watch.cr | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.cr index c6906346..834c76de 100644 --- a/src/invidious/routes/api/manifest.cr +++ b/src/invidious/routes/api/manifest.cr @@ -55,6 +55,10 @@ module Invidious::Routes::API::Manifest end end + audio_streams.reject! do |z| + z if z["audioTrack"]["audioIsDefault"].as_bool == false + end + manifest = XML.build(indent: " ", encoding: "UTF-8") do |xml| xml.element("MPD", "xmlns": "urn:mpeg:dash:schema:mpd:2011", "profiles": "urn:mpeg:dash:profile:full:2011", minBufferTime: "PT1.5S", type: "static", diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index 3a90d822..25f349a2 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -152,6 +152,12 @@ module Invidious::Routes::Watch end end + audio_streams.reject! do |z| + z if z["audioTrack"]["audioIsDefault"].as_bool == false + end + + pp audio_streams + # Older videos may not have audio sources available. # We redirect here so they're not unplayable if audio_streams.empty? && !video.live_now