tiktok & soundcloud: proper best audio picking

also improved tiktok audio file naming scheme. full audio now has the "_audio_original" tag. audio extracted from video is simply "_audio".
This commit is contained in:
wukko
2024-04-30 13:22:29 +06:00
parent 276caa011a
commit ed8af6ca96
4 changed files with 17 additions and 37 deletions

View File

@@ -139,39 +139,20 @@ export default function(r, host, userFormat, isAudioOnly, lang, isAudioMuted, di
const serviceBestAudio = r.bestAudio || services[host]["bestAudio"];
const isBestAudio = audioFormat === "best";
const isBestOrMp3 = audioFormat === "mp3" || isBestAudio;
const isBestOrMp3 = isBestAudio || audioFormat === "mp3";
const isBestAudioDefined = isBestAudio && serviceBestAudio;
const isBestHostAudio = serviceBestAudio && (audioFormat === serviceBestAudio);
const isTikTok = host === "tiktok" || host === "douyin";
const isTumblrAudio = host === "tumblr" && !r.filename;
const isSoundCloud = host === "soundcloud";
if (isTikTok && services.tiktok.audioFormats.includes(audioFormat)) {
if (r.isMp3 && isBestOrMp3) {
audioFormat = "mp3";
processType = "bridge"
} else if (isBestAudio) {
audioFormat = "m4a";
processType = "bridge"
}
}
if (isSoundCloud && services.soundcloud.audioFormats.includes(audioFormat)) {
if (r.isMp3 && isBestOrMp3) {
audioFormat = "mp3";
processType = "render"
copy = true
} else if (isBestAudio || audioFormat === "opus") {
audioFormat = "opus";
processType = "render"
copy = true
}
}
if (isBestAudioDefined || isBestHostAudio) {
audioFormat = serviceBestAudio;
processType = "bridge";
if (isSoundCloud) {
processType = "render"
copy = true
}
} else if (isBestAudio && !isSoundCloud) {
audioFormat = "m4a";
copy = true