mirror of
https://github.com/imputnet/cobalt.git
synced 2025-01-04 06:06:07 +00:00
add option to disable file metadata
merge pull request #191 from dumbmoron/disable-metadata
This commit is contained in:
commit
faee870e3a
|
@ -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`` | Disables file metadata when set to ``true``. |
|
||||
|
||||
### Response Body Variables
|
||||
| key | type | variables |
|
||||
|
|
|
@ -18,7 +18,14 @@ 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 +384,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),
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
"CollapseLegal": "legal stuff",
|
||||
"FairUse": "cobalt is a tool for easing content downloads from internet and takes <span class=\"text-backdrop\">zero liability</span>. you are responsible for what you download, how you use and distribute that content.\n\ncobalt does not log any info about you, it's impossible for me to snitch on you, but please be mindful when using content of others and always credit original creators!\n\nwhen used in education purposes (lecture, homework, etc) please attach the source link.\n\nfair use and credits benefit everyone.",
|
||||
"UrgentFeatureUpdate71": "more supported services!",
|
||||
"UrgentThanks": "thank you for support!"
|
||||
"UrgentThanks": "thank you for support!",
|
||||
"SettingsDisableMetadata": "don't add metadata"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,6 +138,7 @@
|
|||
"CollapseLegal": "правовые штучки",
|
||||
"FairUse": "кобальт - это инструмент для облегчения скачивания контента из интернета, и он <span class=\"text-backdrop\">не несёт никакой ответственности</span>. ты несёшь ответственность за то, что скачиваешь, как используешь и распространяешь скачанный контент.\n\nкобальт не собирает никакой информации о тебе, и не может донести на тебя, но, пожалуйста, будь сознателен при использовании чужого контента и всегда указывай авторов!\n\nпри использовании в образовательных целях (лекции, домашние задания и т.д.), пожалуйста, прикладывай ссылку на источник.\n\nчестное использование и указание авторства выгодно всем.",
|
||||
"UrgentFeatureUpdate71": "расширение поддержки сервисов!",
|
||||
"UrgentThanks": "спасибо за поддержку!"
|
||||
"UrgentThanks": "спасибо за поддержку!",
|
||||
"SettingsDisableMetadata": "не добавлять метаданные"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -440,13 +440,16 @@ export default function(obj) {
|
|||
name: "miscellaneous",
|
||||
title: t('Miscellaneous'),
|
||||
body: checkbox([{
|
||||
action: "disableChangelog",
|
||||
name: t("SettingsDisableNotifications")
|
||||
}, {
|
||||
action: "downloadPopup",
|
||||
name: t("SettingsEnableDownloadPopup"),
|
||||
padding: "no-margin",
|
||||
aria: t("AccessibilityEnableDownloadPopup")
|
||||
}, {
|
||||
action: "disableMetadata",
|
||||
name: t("SettingsDisableMetadata")
|
||||
}, {
|
||||
action: "disableChangelog",
|
||||
name: t("SettingsDisableNotifications"),
|
||||
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