Skip to content

best way to save what you love

oops: part 2

wukko5b61e95c1f37
diff --git a/src/modules/servicesConfig.json b/src/modules/servicesConfig.json
index e4d094b1..890261d3 100644
--- a/src/modules/servicesConfig.json
+++ b/src/modules/servicesConfig.json
@@ -59,6 +59,7 @@
},
"tiktok": {
"patterns": [":user/video/:postId", ":id", "t/:id"],
+ "audioFormats": ["best", "m4a", "mp3"],
"enabled": true
},
"douyin": {
diff --git a/src/modules/sub/matchActionDecider.js b/src/modules/sub/matchActionDecider.js
index cee98600..db73f0ca 100644
--- a/src/modules/sub/matchActionDecider.js
+++ b/src/modules/sub/matchActionDecider.js
@@ -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,