api/youtube: adjust matched resolution

heights like 714 are now adjusted to 720, so that preferred quality is picked correctly
This commit is contained in:
wukko 2024-10-31 21:31:39 +06:00
parent da72b9615e
commit 5470926d52
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -199,8 +199,10 @@ export default async function(o) {
} }
const quality = o.quality === "max" ? 9000 : Number(o.quality); const quality = o.quality === "max" ? 9000 : Number(o.quality);
const matchQuality = (resolution) => {
return resolution.height > resolution.width ? resolution.width : resolution.height; const matchQuality = resolution => {
const quality = resolution.height > resolution.width ? resolution.width : resolution.height;
return Math.ceil(quality / 24) * 24;
} }
let video, audio, dubbedLanguage, let video, audio, dubbedLanguage,