From dcf76f7592ee8e143f7b76f30267fc37a6a61427 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Thu, 14 Aug 2025 19:11:38 +0200 Subject: [PATCH] Make MWEB return the original audio track --- src/renderer/helpers/api/local.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/renderer/helpers/api/local.js b/src/renderer/helpers/api/local.js index 357e42a038cc8..a2e84f9566985 100644 --- a/src/renderer/helpers/api/local.js +++ b/src/renderer/helpers/api/local.js @@ -230,7 +230,18 @@ export async function getLocalVideoInfo(id) { const info = await webInnertube.getInfo(id, { po_token: contentPoToken }) - // temporary workaround for SABR-only responses + // #region temporary workaround for SABR-only responses + + // MWEB doesn't have an audio track selector so it picks the audio track on the server based on the request language. + + const originalAudioTrackFormat = info.streaming_data?.adaptive_formats.find(format => { + return format.has_audio && format.is_original && format.language + }) + + if (originalAudioTrackFormat) { + webInnertube.session.context.client.hl = originalAudioTrackFormat.language + } + const mwebInfo = await webInnertube.getBasicInfo(id, { client: 'MWEB', po_token: contentPoToken }) if (mwebInfo.playability_status.status === 'OK' && mwebInfo.streaming_data) { @@ -240,6 +251,8 @@ export async function getLocalVideoInfo(id) { clientName = 'MWEB' } + // #endregion temporary workaround for SABR-only responses + let hasTrailer = info.has_trailer let trailerIsAgeRestricted = info.getTrailerInfo() === null