api/youtube: use best quality if all else fails

This commit is contained in:
wukko 2024-10-31 21:18:34 +06:00
parent 98acea6c58
commit da72b9615e
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -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;
}
}