youtube: better audio checking

This commit is contained in:
wukko 2024-07-26 20:18:59 +06:00
parent 7071157580
commit 57051968f3
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -176,7 +176,7 @@ export default async function(o) {
if (bestQuality) bestQuality = qual(bestQuality); if (bestQuality) bestQuality = qual(bestQuality);
if (!bestQuality && !o.isAudioOnly || !hasAudio) if ((!bestQuality && !o.isAudioOnly) || !hasAudio)
return { error: 'ErrorYTTryOtherCodec' }; return { error: 'ErrorYTTryOtherCodec' };
if (basicInfo.duration > env.durationLimit) if (basicInfo.duration > env.durationLimit)
@ -227,7 +227,7 @@ export default async function(o) {
youtubeDubName: isDubbed ? o.dubLang : false youtubeDubName: isDubbed ? o.dubLang : false
} }
if (hasAudio && o.isAudioOnly) return { if (audio && o.isAudioOnly) return {
type: "render", type: "render",
isAudioOnly: true, isAudioOnly: true,
urls: audio.decipher(yt.session.player), urls: audio.decipher(yt.session.player),
@ -252,7 +252,7 @@ export default async function(o) {
const video = adaptive_formats.find(checkRender); const video = adaptive_formats.find(checkRender);
if (!match && video) { if (!match && video && audio) {
match = video; match = video;
type = "render"; type = "render";
urls = [ urls = [