best way to save what you love
Svelte collaborationdownloaderinstagramjavascriptmusicredditsocial-mediasoundcloudsveltetiktoktwittertypescriptvideovimeovkwebappyoutubeyoutube-downloader
clean up
wukkofc89cb566bc9
diff --git a/src/modules/pageRender/page.js b/src/modules/pageRender/page.jsindex 50d756f5..1c8a5738 100644--- a/src/modules/pageRender/page.js+++ b/src/modules/pageRender/page.js@@ -7,9 +7,7 @@ import changelogManager from "../changelog/changelogManager.js";let com = getCommitInfo();-let enabledServices = Object.keys(s).filter((p) => {- if (s[p].enabled) return true;-}).sort().map((p) => {+let enabledServices = Object.keys(s).filter(p => s[p].enabled).sort().map((p) => {return `<br>• ${s[p].alias ? s[p].alias : p}`}).join('').substring(4)diff --git a/src/modules/processing/services/bilibili.js b/src/modules/processing/services/bilibili.jsindex b9690aad..0194ee46 100644--- a/src/modules/processing/services/bilibili.js+++ b/src/modules/processing/services/bilibili.js@@ -11,13 +11,13 @@ export default async function(obj) {let streamData = JSON.parse(html.split('<script>window.__playinfo__=')[1].split('</script>')[0]);if (streamData.data.timelength > maxVideoDuration) return { error: ['ErrorLengthLimit', maxVideoDuration / 60000] };- let video = streamData["data"]["dash"]["video"].filter((v) => {- if (!v["baseUrl"].includes("https://upos-sz-mirrorcosov.bilivideo.com/")) return true;- }).sort((a, b) => Number(b.bandwidth) - Number(a.bandwidth));+ let video = streamData["data"]["dash"]["video"].filter(v =>+ !v["baseUrl"].includes("https://upos-sz-mirrorcosov.bilivideo.com/")+ ).sort((a, b) => Number(b.bandwidth) - Number(a.bandwidth));- let audio = streamData["data"]["dash"]["audio"].filter((a) => {- if (!a["baseUrl"].includes("https://upos-sz-mirrorcosov.bilivideo.com/")) return true;- }).sort((a, b) => Number(b.bandwidth) - Number(a.bandwidth));+ let audio = streamData["data"]["dash"]["audio"].filter(a =>+ !a["baseUrl"].includes("https://upos-sz-mirrorcosov.bilivideo.com/")+ ).sort((a, b) => Number(b.bandwidth) - Number(a.bandwidth));return {urls: [video[0]["baseUrl"], audio[0]["baseUrl"]],diff --git a/src/modules/processing/services/soundcloud.js b/src/modules/processing/services/soundcloud.jsindex 6f4d82d8..99c812e1 100644--- a/src/modules/processing/services/soundcloud.js+++ b/src/modules/processing/services/soundcloud.js@@ -59,7 +59,7 @@ export default async function(obj) {if (!json["media"]["transcodings"]) return { error: 'ErrorEmptyDownload' };- let fileUrlBase = json.media.transcodings.filter((v) => { if (v["preset"] === "opus_0_0") return true })[0]["url"],+ let fileUrlBase = json.media.transcodings.filter(v => v.preset === "opus_0_0")[0]["url"],fileUrl = `${fileUrlBase}${fileUrlBase.includes("?") ? "&" : "?"}client_id=${clientId}&track_authorization=${json.track_authorization}`;if (fileUrl.substring(0, 54) !== "https://api-v2.soundcloud.com/media/soundcloud:tracks:") return { error: 'ErrorEmptyDownload' };diff --git a/src/modules/processing/services/tiktok.js b/src/modules/processing/services/tiktok.jsindex 05a9c8d5..bd925b56 100644--- a/src/modules/processing/services/tiktok.js+++ b/src/modules/processing/services/tiktok.js@@ -17,7 +17,7 @@ function selector(j, h, id) {let t;switch (h) {case "tiktok":- t = j["aweme_list"].filter((v) => { if (v["aweme_id"] === id) return true })[0];+ t = j["aweme_list"].filter(v => v["aweme_id"] === id)[0];break;case "douyin":t = j['aweme_detail'];@@ -92,7 +92,7 @@ export default async function(obj) {let imageLinks = [];for (let i in images) {let sel = obj.host === "tiktok" ? images[i]["display_image"]["url_list"] : images[i]["url_list"];- sel = sel.filter((p) => { if (p.includes(".jpeg?")) return true; })+ sel = sel.filter(p => p.includes(".jpeg?"))imageLinks.push({url: sel[0]})}return {diff --git a/src/modules/processing/services/twitter.js b/src/modules/processing/services/twitter.jsindex 189a0c88..487032a8 100644--- a/src/modules/processing/services/twitter.js+++ b/src/modules/processing/services/twitter.js@@ -1,7 +1,7 @@import { genericUserAgent } from "../../config.js";function bestQuality(arr) {- return arr.filter((v) => { if (v["content_type"] === "video/mp4") return true }).sort((a, b) => Number(b.bitrate) - Number(a.bitrate))[0]["url"]+ return arr.filter(v => v["content_type"] === "video/mp4").sort((a, b) => Number(b.bitrate) - Number(a.bitrate))[0]["url"]}export default async function(obj) {diff --git a/src/modules/processing/services/vimeo.js b/src/modules/processing/services/vimeo.jsindex a1c951a5..3765b64e 100644--- a/src/modules/processing/services/vimeo.js+++ b/src/modules/processing/services/vimeo.js@@ -64,7 +64,7 @@ export default async function(obj) {let videoUrl, audioUrl, baseUrl = masterJSONURL.split("/sep/")[0];switch (type) {case "parcel":- let masterJSON_Audio = masterJSON.audio.sort((a, b) => Number(b.bitrate) - Number(a.bitrate)).filter((a) => { if (a['mime_type'] === "audio/mp4") return true }),+ let masterJSON_Audio = masterJSON.audio.sort((a, b) => Number(b.bitrate) - Number(a.bitrate)).filter(a => a['mime_type'] === "audio/mp4"),bestAudio = masterJSON_Audio[0];videoUrl = `${baseUrl}/parcel/video/${bestVideo.index_segment.split('?')[0]}`,audioUrl = `${baseUrl}/parcel/audio/${bestAudio.index_segment.split('?')[0]}`;diff --git a/src/modules/processing/services/youtube.js b/src/modules/processing/services/youtube.jsindex a8beca06..38da4103 100644--- a/src/modules/processing/services/youtube.js+++ b/src/modules/processing/services/youtube.js@@ -39,9 +39,9 @@ export default async function(o) {if (info.playability_status.status !== 'OK') return { error: 'ErrorYTUnavailable' };if (info.basic_info.is_live) return { error: 'ErrorLiveVideo' };- let bestQuality, hasAudio, adaptive_formats = info.streaming_data.adaptive_formats.filter((e) => {- if (e["mime_type"].includes(c[o.format].codec) || e["mime_type"].includes(c[o.format].aCodec)) return true- }).sort((a, b) => Number(b.bitrate) - Number(a.bitrate));+ let bestQuality, hasAudio, adaptive_formats = info.streaming_data.adaptive_formats.filter(e =>+ e["mime_type"].includes(c[o.format].codec) || e["mime_type"].includes(c[o.format].aCodec)+ ).sort((a, b) => Number(b.bitrate) - Number(a.bitrate));bestQuality = adaptive_formats.find(i => i["has_video"]);hasAudio = adaptive_formats.find(i => i["has_audio"]);