parent
b56edfc193
commit
93aa1f4db4
8 changed files with 18 additions and 8 deletions
|
@ -26,6 +26,7 @@ Response Body Type: ``application/json``
|
|||
| isTTFullAudio | boolean | ``true / false`` | ``false`` | Enables download of original sound used in a TikTok video. |
|
||||
| isAudioMuted | boolean | ``true / false`` | ``false`` | Disables audio track in video downloads. |
|
||||
| dubLang | boolean | ``true / false`` | ``false`` | Backend uses Accept-Language for YouTube video audio tracks when ``true``. |
|
||||
| disableMetadata | boolean | ``true / false`` | ``false`` | Does not add metadata to the downloaded audio/video |
|
||||
|
||||
### Response Body Variables
|
||||
| key | type | variables |
|
||||
|
|
|
@ -18,7 +18,7 @@ const switchers = {
|
|||
"vimeoDash": ["false", "true"],
|
||||
"audioMode": ["false", "true"]
|
||||
};
|
||||
const checkboxes = ["disableTikTokWatermark", "fullTikTokAudio", "muteAudio", "reduceTransparency", "disableAnimations"];
|
||||
const checkboxes = ["disableTikTokWatermark", "fullTikTokAudio", "muteAudio", "reduceTransparency", "disableAnimations", "disableMetadata"];
|
||||
const exceptions = { // used for mobile devices
|
||||
"vQuality": "720"
|
||||
};
|
||||
|
@ -377,6 +377,8 @@ async function download(url) {
|
|||
if ((url.includes("tiktok.com/") || url.includes("douyin.com/")) && sGet("disableTikTokWatermark") === "true") req.isNoTTWatermark = true;
|
||||
}
|
||||
|
||||
if (sGet("disableMetadata") === "true") req.disableMetadata = true;
|
||||
|
||||
let j = await fetch(`${apiURL}/api/json`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify(req),
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
"SettingsKeepDownloadButton": "keep >> visible",
|
||||
"AccessibilityKeepDownloadButton": "keep the download button always visible",
|
||||
"SettingsEnableDownloadPopup": "ask how to save",
|
||||
"SettingsDisableMetadata": "disable file metadata",
|
||||
"AccessibilityEnableDownloadPopup": "ask what to do with downloads",
|
||||
"SettingsQualityDescription": "if selected quality isn't available, closest one is used instead.",
|
||||
"LinkGitHubChanges": ">> see previous commits and contribute on github",
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
"SettingsKeepDownloadButton": "всегда показывать >>",
|
||||
"AccessibilityKeepDownloadButton": "всегда показывать кнопку скачивания на экране",
|
||||
"SettingsEnableDownloadPopup": "выбор метода скачивания",
|
||||
"SettingsDisableMetadata": "disable file metadata",
|
||||
"AccessibilityEnableDownloadPopup": "спрашивать, что делать с загрузками",
|
||||
"SettingsQualityDescription": "если выбранное качество недоступно, то выбирается ближайшее к нему.",
|
||||
"LinkGitHubChanges": ">> смотри предыдущие изменения на github",
|
||||
|
|
|
@ -447,6 +447,10 @@ export default function(obj) {
|
|||
name: t("SettingsEnableDownloadPopup"),
|
||||
padding: "no-margin",
|
||||
aria: t("AccessibilityEnableDownloadPopup")
|
||||
}, {
|
||||
action: "disableMetadata",
|
||||
name: t("SettingsDisableMetadata"),
|
||||
padding: "no-margin"
|
||||
}])
|
||||
})
|
||||
}],
|
||||
|
|
|
@ -22,7 +22,7 @@ import streamable from "./services/streamable.js";
|
|||
|
||||
export default async function (host, patternMatch, url, lang, obj) {
|
||||
try {
|
||||
let r, isAudioOnly = !!obj.isAudioOnly;
|
||||
let r, isAudioOnly = !!obj.isAudioOnly, disableMetadata = !!obj.disableMetadata;
|
||||
|
||||
if (!testers[host]) return apiJSON(0, { t: errorUnsupported(lang) });
|
||||
if (!(testers[host](patternMatch))) return apiJSON(0, { t: brokenLink(lang, host) });
|
||||
|
@ -131,7 +131,7 @@ export default async function (host, patternMatch, url, lang, obj) {
|
|||
|
||||
if (r.error) return apiJSON(0, { t: Array.isArray(r.error) ? loc(lang, r.error[0], r.error[1]) : loc(lang, r.error) });
|
||||
|
||||
return matchActionDecider(r, host, obj.aFormat, isAudioOnly, lang, isAudioMuted);
|
||||
return matchActionDecider(r, host, obj.aFormat, isAudioOnly, lang, isAudioMuted, disableMetadata);
|
||||
} catch (e) {
|
||||
return apiJSON(0, { t: genericError(lang, host) })
|
||||
}
|
||||
|
|
|
@ -2,17 +2,17 @@ import { audioIgnore, services, supportedAudio } from "../config.js";
|
|||
import { apiJSON } from "../sub/utils.js";
|
||||
import loc from "../../localization/manager.js";
|
||||
|
||||
export default function(r, host, audioFormat, isAudioOnly, lang, isAudioMuted) {
|
||||
export default function(r, host, audioFormat, isAudioOnly, lang, isAudioMuted, disableMetadata) {
|
||||
let action,
|
||||
responseType = 2,
|
||||
defaultParams = {
|
||||
u: r.urls,
|
||||
service: host,
|
||||
filename: r.filename,
|
||||
fileMetadata: r.fileMetadata ? r.fileMetadata : false
|
||||
fileMetadata: !disableMetadata ? r.fileMetadata : false
|
||||
},
|
||||
params = {}
|
||||
|
||||
|
||||
if (r.isPhoto) action = "photo";
|
||||
else if (r.picker) action = "picker"
|
||||
else if (isAudioMuted) action = "muteVideo";
|
||||
|
|
|
@ -6,7 +6,7 @@ const apiVar = {
|
|||
vQuality: ["max", "4320", "2160", "1440", "1080", "720", "480", "360", "240", "144"],
|
||||
aFormat: ["best", "mp3", "ogg", "wav", "opus"]
|
||||
},
|
||||
booleanOnly: ["isAudioOnly", "isNoTTWatermark", "isTTFullAudio", "isAudioMuted", "dubLang", "vimeoDash"]
|
||||
booleanOnly: ["isAudioOnly", "isNoTTWatermark", "isTTFullAudio", "isAudioMuted", "dubLang", "vimeoDash", "disableMetadata"]
|
||||
}
|
||||
const forbiddenChars = ['}', '{', '(', ')', '\\', '%', '>', '<', '^', '*', '!', '~', ';', ':', ',', '`', '[', ']', '#', '$', '"', "'", "@", '=='];
|
||||
const forbiddenCharsString = ['}', '{', '%', '>', '<', '^', ';', '`', '$', '"', "@", '='];
|
||||
|
@ -101,13 +101,14 @@ export function checkJSONPost(obj) {
|
|||
isNoTTWatermark: false,
|
||||
isTTFullAudio: false,
|
||||
isAudioMuted: false,
|
||||
disableMetadata: false,
|
||||
dubLang: false,
|
||||
vimeoDash: false
|
||||
}
|
||||
try {
|
||||
let objKeys = Object.keys(obj);
|
||||
if (!(objKeys.length <= 9 && obj.url)) return false;
|
||||
let defKeys = Object.keys(def);
|
||||
if (objKeys.length > defKeys.length + 1 || !obj.url) return false;
|
||||
|
||||
for (let i in objKeys) {
|
||||
if (String(objKeys[i]) !== "url" && defKeys.includes(objKeys[i])) {
|
||||
|
|
Loading…
Reference in a new issue