downloaderjavascript256
VidSave - Universal Multi-Platform Video & Audio Downloader (YouTube 4K, TikTok, IG, FB, Pinterest, Twitter)
Engine video downloader VidSave (vidsave.com / vidssave.com) dengan AES CBC decryptor, multi-kualitas hingga 4K/2160p & MP3 audio extractor.
Vamz Spectre17 Okt 2026317 baris kode
Jalankan via Terminal / CLI:
# 1. Download file script
curl -sL "https://code.vamxapi.my.id/snippet/raw/vidsave" -o vidsave.js
# 2. Jalankan script
node vidsave.js
Dependencies npm yang Dibutuhkan:
npm install none (native fetch & crypto)Panduan Penggunaan:
curl -sL "https://code.vamxapi.my.id/snippet/raw/vidsave" -o vidsave.js && node vidsave.js "<url>"
vidsave.js(317 lines)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/**
* VidSave (vidsave.com / vidssave.com) Universal Video & Audio Downloader
* Author: Vamz Spectre / VamxAPI
*
* Scraper & Downloader engine reverse-engineered dari VidSave API:
* - Multi-platform: YouTube (144p - 4K 2160p, MP3 Audio), TikTok, Instagram, Facebook, Twitter/X, Pinterest, Threads, Reddit, Dailymotion
* - AES CBC Decryption engine terintegrasi untuk reverse backend token
* - Server-Sent Events (SSE) download progress & link resolution
* - Tanpa dependency eksternal (menggunakan native Node.js crypto & fetch)
*
* Cara Penggunaan CLI:
* 1. Download file:
* curl -sL "https://code.vamxapi.my.id/snippet/raw/vidsave" -o vidsave.js
*
* 2. Eksekusi:
* node vidsave.js "<url>" (Download video standar)
* node vidsave.js "<url>" parse (Hanya parse info video & list kualitas)
* node vidsave.js "<url>" 1080p (Download kualitas spesifik)
* node vidsave.js "<url>" audio (Download audio MP3)
*/
const crypto = require("crypto");
const AES_KEYS = [
"4c9b7d2e".repeat(3) + "4c9b7d21",
"rz18efAXUbdiaO7k"
];
const BASE_API = "https://api.vidssave.com/api/contentsite_api";
const SSE_BASE = "https://api.vidssave.com/sse/contentsite_api";
const DEFAULT_HEADERS = {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"Referer": "https://vidssave.com/",
"Origin": "https://vidssave.com",
"Content-Type": "application/x-www-form-urlencoded"
};
/**
* Decrypt ZeroPadding AES CBC cipher
*/
function decryptAES(cipherTextB64) {
const cleanB64 = cipherTextB64.trim();
for (const keyStr of AES_KEYS) {
try {
const key = Buffer.from(keyStr, "utf8");
const iv = Buffer.from(keyStr.slice(0, 16), "utf8");
const decipher = crypto.createDecipheriv(
key.length === 32 ? "aes-256-cbc" : "aes-128-cbc",
key,
iv
);
decipher.setAutoPadding(false);
const decrypted = Buffer.concat([
decipher.update(Buffer.from(cleanB64, "base64")),
decipher.final()
]);
let end = decrypted.length;
while (end > 0 && decrypted[end - 1] === 0) end--;
const text = decrypted.slice(0, end).toString("utf8");
return JSON.parse(text);
} catch {
// Coba key berikutnya
}
}
throw new Error("Gagal melakukan dekripsi respon AES dari VidSave");
}
/**
* Request helper ke API VidSave
*/
async function requestApi(path, data = {}) {
const payload = {
hostname: "vidssave.com",
auth: "4c9b7d21",
domain: "api-ak.vidssave.com",
...data
};
const body = new URLSearchParams(payload).toString();
const res = await fetch(`${BASE_API}/${path}`, {
method: "POST",
headers: DEFAULT_HEADERS,
body
});
if (!res.ok) {
throw new Error(`HTTP error ${res.status}: ${res.statusText}`);
}
const json = await res.json();
if (json.status !== 1) {
throw new Error(json.msg || json.message || `VidSave API error status ${json.status}`);
}
if (typeof json.data === "string") {
return decryptAES(json.data);
}
return json.data;
}
/**
* Parse metadata media dari URL
*/
async function parse(videoUrl) {
if (!videoUrl) throw new Error("URL video tidak boleh kosong");
const data = await requestApi("media/parse", {
origin: "source",
link: videoUrl
});
return {
status: true,
title: data.title || "Video",
duration: data.duration || 0,
durationFormatted: data.duration
? Math.floor(data.duration / 60) + ":" + String(data.duration % 60).padStart(2, "0")
: null,
thumbnail: data.thumbnail || "",
resources: (data.resources || []).map(r => ({
quality: r.quality,
format: r.format,
type: r.type,
size: r.size || 0,
sizeFormatted: r.size ? (r.size / (1024 * 1024)).toFixed(2) + " MB" : null,
resourceContent: r.resource_content
}))
};
}
/**
* Generate direct download URL via task SSE
*/
async function getDownloadLink(resourceContent, format = "") {
const postData = {
request: resourceContent,
no_encrypt: 1
};
if (format) postData.output = format.toLowerCase();
const dlData = await requestApi("media/download", postData);
const taskId = dlData.task_id;
if (!taskId) throw new Error("Tidak menemukan task_id dari server VidSave");
const sseUrl = `${SSE_BASE}/media/download_query?auth=20250901majwlqo&domain=api-ak.vidssave.com&task_id=${encodeURIComponent(
taskId
)}&download_domain=vidssave.com&origin=content_site`;
const sseRes = await fetch(sseUrl, {
headers: {
"User-Agent": DEFAULT_HEADERS["User-Agent"],
"Referer": DEFAULT_HEADERS["Referer"],
"Accept": "text/event-stream"
}
});
const reader = sseRes.body.getReader();
const decoder = new TextDecoder();
let downloadRedirect = null;
let sseInfo = null;
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
for (const line of chunk.split("\n")) {
if (line.startsWith("data:")) {
try {
const parsed = JSON.parse(line.slice(5).trim());
if (parsed.download_link) {
downloadRedirect = parsed.download_link;
sseInfo = parsed;
break;
}
} catch {}
}
}
if (downloadRedirect) break;
}
if (!downloadRedirect) {
throw new Error("Koneksi SSE selesai tanpa menghasilkan tautan download");
}
// Ambil redirect lokasi CDN asli (HTTP 302)
const redRes = await fetch(downloadRedirect, {
redirect: "manual",
headers: {
"User-Agent": DEFAULT_HEADERS["User-Agent"]
}
});
const directUrl = redRes.headers.get("location") || downloadRedirect;
return {
downloadUrl: directUrl,
fileSize: sseInfo ? sseInfo.filesize : null,
fileSizeFormatted: sseInfo && sseInfo.filesize ? (sseInfo.filesize / (1024 * 1024)).toFixed(2) + " MB" : null
};
}
/**
* Download wrapper: parse lalu otomatis request download link
*/
async function download(videoUrl, options = {}) {
const info = await parse(videoUrl);
let target = null;
if (typeof options === "string") {
if (options.toLowerCase() === "audio" || options.toLowerCase() === "mp3") {
target = info.resources.find(r => r.type === "audio");
} else {
target = info.resources.find(
r => r.quality.toLowerCase() === options.toLowerCase()
);
}
} else if (options && typeof options === "object") {
if (options.quality) {
target = info.resources.find(
r => r.quality.toLowerCase() === options.quality.toLowerCase()
);
}
if (!target && options.type) {
target = info.resources.find(
r => r.type.toLowerCase() === options.type.toLowerCase()
);
}
}
if (!target) {
target = info.resources.find(r => r.type === "video") || info.resources[0];
}
if (!target) throw new Error("Tidak ada resource video/audio yang tersedia untuk diunduh");
const dl = await getDownloadLink(target.resourceContent, target.format);
return {
status: true,
title: info.title,
duration: info.duration,
durationFormatted: info.durationFormatted,
thumbnail: info.thumbnail,
selected: {
quality: target.quality,
format: target.format,
type: target.type
},
downloadUrl: dl.downloadUrl,
fileSize: dl.fileSize,
fileSizeFormatted: dl.fileSizeFormatted,
availableFormats: info.resources.map(r => ({
quality: r.quality,
format: r.format,
type: r.type,
sizeFormatted: r.sizeFormatted
}))
};
}
module.exports = {
parse,
getDownloadLink,
download
};
// CLI Runner
if (require.main === module) {
(async () => {
const args = process.argv.slice(2);
const videoUrl = args[0];
const modeOrQuality = args[1];
if (!videoUrl) {
console.log(
JSON.stringify(
{
status: false,
message: "Gunakan: node vidsave.js <URL> [quality|audio|parse]",
examples: [
"node vidsave.js \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\"",
"node vidsave.js \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\" parse",
"node vidsave.js \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\" 1080p",
"node vidsave.js \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\" audio"
]
},
null,
2
)
);
process.exit(1);
}
try {
let result;
if (modeOrQuality === "parse") {
result = await parse(videoUrl);
} else {
result = await download(videoUrl, modeOrQuality);
}
console.log(JSON.stringify(result, null, 2));
} catch (err) {
console.error(
JSON.stringify(
{
status: false,
error: err.message
},
null,
2
)
);
process.exit(1);
}
})();
}