oops: part 2

This commit is contained in:
wukko 2022-08-23 21:05:30 +06:00
parent 7472b1732a
commit 5b61e95c1f
2 changed files with 18 additions and 13 deletions

View file

@ -59,6 +59,7 @@
},
"tiktok": {
"patterns": [":user/video/:postId", ":id", "t/:id"],
"audioFormats": ["best", "m4a", "mp3"],
"enabled": true
},
"douyin": {

View file

@ -45,9 +45,24 @@ export default function(r, host, ip, audioFormat, isAudioOnly) {
return apiJSON(1, { u: r.urls })
}
} else {
let type = "render"
let copy = false
if (host == "reddit" && r.typeId == 1 || audioIgnore.includes(host)) return apiJSON(0, { t: r.audioFilename });
let type = "render";
let copy = false;
if (!supportedAudio.includes(audioFormat)) audioFormat = "best";
if ((host == "tiktok" || host == "douyin") && r.isAudio && services.tiktok.audioFormats.includes(audioFormat)) {
if (r.isMp3) {
if (audioFormat == "mp3" || audioFormat == "best") {
audioFormat = "mp3"
type = "bridge"
}
} else if (audioFormat == "best") {
audioFormat = "m4a"
type = "bridge"
}
}
if ((audioFormat == "best" && services[host]["bestAudio"]) || services[host]["bestAudio"] && (audioFormat == services[host]["bestAudio"])) {
audioFormat = services[host]["bestAudio"]
type = "bridge"
@ -55,17 +70,6 @@ export default function(r, host, ip, audioFormat, isAudioOnly) {
audioFormat = "m4a"
copy = true
}
if ((host == "tiktok" || host == "douyin") && r.isAudio && audioFormat == "best") {
if (r.isMp3) {
audioFormat = "mp3"
type = "bridge"
copy = false
} else {
type = "bridge"
copy = false
}
}
if (host == "reddit" && r.typeId == 1 || audioIgnore.includes(host)) return apiJSON(0, { t: r.audioFilename });
return apiJSON(2, {
type: type,
u: Array.isArray(r.urls) ? r.urls[1] : r.urls, service: host, ip: ip,