api/youtube: add no matching format error

this error is returned when cobalt got a response from innertube, but couldn't find a matching combo of video and audio streams. sometimes youtube returns only video or only audio per format combo for whatever reason.
This commit is contained in:
wukko 2024-11-13 15:00:09 +06:00
parent 8b972c7a85
commit 5f1c19d0f1
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -264,7 +264,7 @@ export default async function(o) {
}
if (!selected) {
return { error: "youtube.no_hls_streams" };
return { error: "youtube.no_matching_format" };
}
audio = selected.audio.find(i => i.isDefault);
@ -320,7 +320,7 @@ export default async function(o) {
const bestAudio = !fallback ? earlyBestAudio : adaptive_formats.find(i => checkBestAudio(i));
if (checkNoMedia(bestVideo, bestAudio)) {
return { error: "youtube.codec" };
return { error: "youtube.no_matching_format" };
}
audio = bestAudio;
@ -443,5 +443,5 @@ export default async function(o) {
}
}
return { error: "fetch.fail" };
return { error: "youtube.no_matching_format" };
}