youtube: ignore formats with missing content length

This commit is contained in:
dumbmoron 2024-05-13 16:54:00 +00:00
parent 840bdf35b7
commit d7a3a7cac4
No known key found for this signature in database

View file

@ -66,8 +66,8 @@ export default async function(o) {
adaptive_formats = filterByCodec(info.streaming_data.adaptive_formats) adaptive_formats = filterByCodec(info.streaming_data.adaptive_formats)
} }
bestQuality = adaptive_formats.find(i => i.has_video); bestQuality = adaptive_formats.find(i => i.has_video && i.content_length);
hasAudio = adaptive_formats.find(i => i.has_audio); hasAudio = adaptive_formats.find(i => i.has_audio && i.content_length);
if (bestQuality) bestQuality = qual(bestQuality); if (bestQuality) bestQuality = qual(bestQuality);
if (!bestQuality && !o.isAudioOnly || !hasAudio) return { error: 'ErrorYTTryOtherCodec' }; if (!bestQuality && !o.isAudioOnly || !hasAudio) return { error: 'ErrorYTTryOtherCodec' };