youtube: update stub handling

This commit is contained in:
wukko 2024-04-27 18:05:43 +06:00
parent dd56ae60e7
commit 66b3697b24
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -23,7 +23,9 @@ const c = {
}
export default async function(o) {
let info, isDubbed, quality = o.quality === "max" ? "9000" : o.quality; //set quality 9000(p) to be interpreted as max
let info, isDubbed,
quality = o.quality === "max" ? "9000" : o.quality; // 9000(p) - max quality
function qual(i) {
if (!i.quality_label) {
return;
@ -43,6 +45,15 @@ export default async function(o) {
if (info.playability_status.status !== 'OK') return { error: 'ErrorYTUnavailable' };
if (info.basic_info.is_live) return { error: 'ErrorLiveVideo' };
// return a critical error if returned video is "Video Not Available"
// or a similar stub by youtube
if (info.basic_info.id !== o.id) {
return {
error: 'ErrorCantConnectToServiceAPI',
critical: true
}
}
let bestQuality, hasAudio;
let adaptive_formats = info.streaming_data.adaptive_formats.filter(e =>
@ -89,12 +100,6 @@ export default async function(o) {
youtubeDubName: isDubbed ? o.dubLang : false
}
if (filenameAttributes.title === "Video Not Available" && filenameAttributes.author === "YouTube Viewers")
return {
error: 'ErrorCantConnectToServiceAPI',
critical: true
}
if (hasAudio && o.isAudioOnly) return {
type: "render",
isAudioOnly: true,