added ability to download full audios from tiktok (3.3.5)

- it's now possible to download full audios from tiktok videos, you just have to turn that on in settings.
- tiktok audios are better in quality when it's possible to get exact audio used in video and not the full version of it.
- cleaned up the way user preference stuff is passed over between modules, should be way more flexible now.
- added audio ignore list to services config json instead of hardcoding it.
This commit is contained in:
wukko
2022-08-23 20:43:56 +06:00
parent 189ecf8fe7
commit a8b5555a1b
14 changed files with 182 additions and 114 deletions

View File

@@ -1,4 +1,4 @@
import { services, supportedAudio } from "../config.js"
import { audioIgnore, services, supportedAudio } from "../config.js"
import { apiJSON } from "./utils.js"
export default function(r, host, ip, audioFormat, isAudioOnly) {
@@ -55,7 +55,17 @@ export default function(r, host, ip, audioFormat, isAudioOnly) {
audioFormat = "m4a"
copy = true
}
if (host == "reddit" && r.typeId == 1 || host == "vk" || host == "vimeo") return apiJSON(0, { t: r.audioFilename });
if ((host == "tiktok" || host == "douyin") && r.isAudio) {
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,