best way to save what you love
Svelte collaborationdownloaderinstagramjavascriptmusicredditsocial-mediasoundcloudsveltetiktoktwittertypescriptvideovimeovkwebappyoutubeyoutube-downloader
fixes
wukkoa1fea0a5f109
diff --git a/src/front/cobalt.js b/src/front/cobalt.jsindex 13333ae9..0628d355 100644--- a/src/front/cobalt.js+++ b/src/front/cobalt.js@@ -273,7 +273,7 @@ function toggle(toggl) {}function loadSettings() {try {- if (typeof(navigator.clipboard.readText) === undefined) throw new Error();+ if (typeof(navigator.clipboard.readText) == "undefined") throw new Error();} catch (err) {eid("pasteFromClipboard").style.display = "none"}diff --git a/src/modules/processing/match.js b/src/modules/processing/match.jsindex c851697f..3336bb4a 100644--- a/src/modules/processing/match.js+++ b/src/modules/processing/match.js@@ -1,5 +1,5 @@import { apiJSON } from "../sub/utils.js";-import { errorUnsupported, genericError } from "../sub/errors.js";+import { errorUnsupported, genericError, brokenLink } from "../sub/errors.js";import loc from "../../localization/manager.js";diff --git a/src/modules/processing/services/reddit.js b/src/modules/processing/services/reddit.jsindex 30d51b71..816a8da6 100644--- a/src/modules/processing/services/reddit.js+++ b/src/modules/processing/services/reddit.js@@ -8,7 +8,7 @@ export default async function(obj) {if (data.url.endsWith('.gif')) return { typeId: 1, urls: data.url };- if (!"reddit_video" in data["secure_media"]) return { error: 'ErrorEmptyDownload' };+ if (!("reddit_video" in data["secure_media"])) return { error: 'ErrorEmptyDownload' };if (data["secure_media"]["reddit_video"]["duration"] * 1000 > maxVideoDuration) return { error: ['ErrorLengthLimit', maxVideoDuration / 60000] };let video = data["secure_media"]["reddit_video"]["fallback_url"].split('?')[0],diff --git a/src/modules/processing/services/tiktok.js b/src/modules/processing/services/tiktok.jsindex ccd10f2c..dac6fe43 100644--- a/src/modules/processing/services/tiktok.js+++ b/src/modules/processing/services/tiktok.js@@ -28,7 +28,9 @@ function selector(j, h, id) {}export default async function(obj) {- if (!obj.postId) {+ let postId = obj.postId ? obj.postId : false;++ if (!postId) {let html = await fetch(`${config[obj.host]["short"]}${obj.id}`, {redirect: "manual",headers: { "user-agent": userAgent }@@ -36,22 +38,22 @@ export default async function(obj) {if (!html) return { error: 'ErrorCouldntFetch' };if (html.slice(0, 17) === '<a href="https://' && html.includes('/video/')) {- obj.postId = html.split('/video/')[1].split('?')[0].replace("/", '')+ postId = html.split('/video/')[1].split('?')[0].replace("/", '')} else if (html.slice(0, 32) === '<a href="https://m.tiktok.com/v/' && html.includes('/v/')) {- obj.postId = html.split('/v/')[1].split('.html')[0].replace("/", '')+ postId = html.split('/v/')[1].split('.html')[0].replace("/", '')}}- if (!obj.postId) return { error: 'ErrorCantGetID' };+ if (!postId) return { error: 'ErrorCantGetID' };let detail;- detail = await fetch(config[obj.host]["api"].replace("{postId}", obj.postId), {+ detail = await fetch(config[obj.host]["api"].replace("{postId}", postId), {headers: {"user-agent": "TikTok 26.2.0 rv:262018 (iPhone; iOS 14.4.2; en_US) Cronet"}}).then((r) => { return r.json() }).catch(() => { return false });- detail = selector(detail, obj.host, obj.postId);+ detail = selector(detail, obj.host, postId);if (!detail) return { error: 'ErrorCouldntFetch' };- let video, videoFilename, audioFilename, isMp3, audio, images, filenameBase = `${obj.host}_${obj.postId}`;+ let video, videoFilename, audioFilename, isMp3, audio, images, filenameBase = `${obj.host}_${postId}`;if (obj.host === "tiktok") {images = detail["image_post_info"] ? detail["image_post_info"]["images"] : false} else {diff --git a/src/modules/processing/services/vk.js b/src/modules/processing/services/vk.jsindex c30d1e7f..b7370af2 100644--- a/src/modules/processing/services/vk.js+++ b/src/modules/processing/services/vk.js@@ -36,7 +36,7 @@ export default async function(obj) {let maxQuality = js["player"]["params"][0][selectedQuality].split('type=')[1].slice(0, 1);let userQuality = selectQuality('vk', obj.quality, Object.entries(services.vk.quality_match).reduce((r, [k, v]) => { r[v] = k; return r; })[maxQuality]);let userRepr = repr[services.vk.representation_match[userQuality]]["_attributes"];- if (!selectedQuality in js["player"]["params"][0]) return { error: 'ErrorEmptyDownload' };+ if (!(selectedQuality in js["player"]["params"][0])) return { error: 'ErrorEmptyDownload' };return {urls: js["player"]["params"][0][`url${userQuality}`],