From da72b9615e30022b708aab93d7d675c9a79c9316 Mon Sep 17 00:00:00 2001 From: wukko Date: Thu, 31 Oct 2024 21:18:34 +0600 Subject: [PATCH] api/youtube: use best quality if all else fails --- api/src/processing/services/youtube.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/processing/services/youtube.js b/api/src/processing/services/youtube.js index e3265b33..affdf40f 100644 --- a/api/src/processing/services/youtube.js +++ b/api/src/processing/services/youtube.js @@ -345,11 +345,13 @@ export default async function(o) { } const bestQuality = qual(bestVideo); - const useBestQuality = quality > bestQuality; + const useBestQuality = quality >= bestQuality; video = useBestQuality ? bestVideo : adaptive_formats.find(i => qual(i) === quality && checkBestVideo(i) ); + + if (!video) video = bestVideo; } }