added file metadata to videos & fixed youtube dubs

This commit is contained in:
wukko
2023-08-20 18:14:15 +06:00
parent 609bf26dd4
commit 2929b9535f
7 changed files with 48 additions and 34 deletions

View File

@@ -1,6 +1,6 @@
import { createStream } from "../stream/manage.js";
let apiVar = {
const apiVar = {
allowed: {
vCodec: ["h264", "av1", "vp9"],
vQuality: ["max", "4320", "2160", "1440", "1080", "720", "480", "360", "240", "144"],
@@ -8,6 +8,8 @@ let apiVar = {
},
booleanOnly: ["isAudioOnly", "isNoTTWatermark", "isTTFullAudio", "isAudioMuted", "dubLang", "vimeoDash"]
}
const forbiddenChars = ['}', '{', '(', ')', '\\', '%', '>', '<', '^', '*', '!', '~', ';', ':', ',', '`', '[', ']', '#', '$', '"', "'", "@", '=='];
const forbiddenCharsString = ['}', '{', '%', '>', '<', '^', ';', '`', '$', '"', "@", '='];
export function apiJSON(type, obj) {
try {
@@ -62,7 +64,6 @@ export function msToTime(d) {
return r;
}
export function cleanURL(url, host) {
let forbiddenChars = ['}', '{', '(', ')', '\\', '%', '>', '<', '^', '*', '!', '~', ';', ':', ',', '`', '[', ']', '#', '$', '"', "'", "@", '==']
switch(host) {
case "vk":
url = url.includes('clip') ? url.split('&')[0] : url.split('?')[0];
@@ -88,6 +89,12 @@ export function cleanURL(url, host) {
}
return url.slice(0, 128)
}
export function cleanString(string) {
for (let i in forbiddenCharsString) {
string = string.replaceAll(forbiddenCharsString[i], '')
}
return string;
}
export function verifyLanguageCode(code) {
return RegExp(/[a-z]{2}/).test(String(code.slice(0, 2).toLowerCase())) ? String(code.slice(0, 2).toLowerCase()) : "en"
}