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

@@ -7,6 +7,7 @@ let switchers = {
"quality": ["max", "hig", "mid", "low"],
"audioFormat": ["best", "mp3", "ogg", "wav", "opus"]
}
let checkboxes = ["disableTikTokWatermark", "fullTikTokAudio"]
let exceptions = { // used solely for ios devices, because they're less capable than everything else.
"ytFormat": "mp4",
"audioFormat": "mp3"
@@ -176,8 +177,8 @@ function loadSettings() {
if (!sGet("audioMode")) {
toggle("audioMode")
}
if (sGet("disableTikTokWatermark") == "true") {
eid("disableTikTokWatermark").checked = true;
for (let i = 0; i < checkboxes.length; i++) {
if (sGet(checkboxes[i]) == "true") eid(checkboxes[i]).checked = true;
}
updateToggle("audioMode", sGet("audioMode"));
for (let i in switchers) {
@@ -226,6 +227,7 @@ async function download(url) {
}
} else {
format = `&nw=true`
if (sGet("fullTikTokAudio") == "true") format += `&ttfull=true`
}
let mode = (sGet("audioMode") == "true") ? `audio=true` : `quality=${sGet("quality")}`
fetch(`/api/json?audioFormat=${sGet("audioFormat")}&${mode}${format}&url=${encodeURIComponent(url)}`).then(async (response) => {