downloaderjavascript248
FDown - Facebook Video & Reel Downloader Engine (SD/HD)
Engine scraper Facebook Video & Reels berbasis FDown.net (sebelumnya FBDown). Mendukung ekstraksi link resolusi SD (Standard Definition) dan HD (High Definition) langsung dari CDN Facebook publik.
Vamz Spectre7 Okt 2026153 baris kode
Jalankan via Terminal / CLI:
# 1. Download file script
curl -sL "https://code.vamxapi.my.id/snippet/raw/fdown-facebook-downloader" -o fdown-facebook-downloader.js
# 2. Jalankan script
node fdown-facebook-downloader.js
Dependencies npm yang Dibutuhkan:
npm install cheerioPanduan Penggunaan:
// Persyaratan: Node.js 18+
// Dependensi: npm install cheerio
// 1. Simpan script ke file: fdown.js
// 2. Eksekusi via Terminal / CLI:
node fdown-facebook-downloader.js "https://www.facebook.com/watch/?v=10153231379946729"
// 3. Integrasi Modular (CommonJS):
const { fdown } = require(./fdown-facebook-downloader);
async function test() {
const url = "https://www.facebook.com/watch/?v=10153231379946729";
const res = await fdown(url);
if (res.status) {
console.log("Judul:", res.result.title);
console.log("Download HD:", res.result.hd);
console.log("Download SD:", res.result.sd);
} else {
console.log("Gagal:", res.message);
}
}
test();
// 4. Integrasi Bot WhatsApp (Baileys / VamxBotz):
case 'fbdown':
case 'fdown': {
const url = text.trim();
if (!url) return m.reply("❌ Masukkan link video Facebook!\nContoh: .fdown https://www.facebook.com/watch/?v=xxxx");
await m.reply("⏳ Sedang memproses video Facebook via FDown...");
try {
const res = await fdown(url);
if (!res.status) return m.reply("❌ " + res.message);
const { title, hd, sd } = res.result;
const downloadUrl = hd || sd;
let caption = `🎬 *${title}*\n\n`;
if (hd) caption += `✨ *HD:* Tersedia\n`;
if (sd) caption += `⚡ *SD:* Tersedia\n`;
await conn.sendMessage(m.chat, {
video: { url: downloadUrl },
caption: caption
}, { quoted: m });
} catch (err) {
m.reply("❌ Error: " + err.message);
}
}fdown-facebook-downloader.js(153 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
/**
* FDown.net Facebook Video & Reels Downloader Engine
* Scraper untuk ekstraksi video SD/HD Facebook via FDown (FBDown)
*
* Target: https://fdown.net/download.php
* Author: Vamz Spectre
* License: MIT
*/
const cheerio = require("cheerio");
const FDOWN_BASE_URL = "https://fdown.net";
/**
* Normalisasi dan validasi link video Facebook
* @param {string} url - Link Facebook (Reels, Watch, Share, Post)
* @returns {string} URL bersih
*/
function cleanFacebookUrl(url) {
if (!url || typeof url !== "string") {
throw new Error("Parameter URL Facebook wajib diisi.");
}
const match = url.match(/(https?:\/\/[^\s]+)/i);
return match ? match[1].replace(/[)\]}>,.;!]+$/, "") : url.trim();
}
/**
* Scraper utama FDown.net
* @param {string} url - Link video atau reels Facebook
* @param {Object} [options] - Opsi lanjutan (custom token, proxy, cookies)
* @param {string} [options.turnstileToken] - Token cf-turnstile-response jika menggunakan captcha solver
* @param {string} [options.cookie] - Cookie sesi browser
* @returns {Promise<Object>} Respon terstruktur standar VamxAPI
*/
async function fdown(url, options = {}) {
try {
const targetUrl = cleanFacebookUrl(url);
const formData = new URLSearchParams();
formData.append("URLz", targetUrl);
if (options.turnstileToken) {
formData.append("cf-turnstile-response", options.turnstileToken);
}
const headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
"Referer": `${FDOWN_BASE_URL}/`,
"Origin": FDOWN_BASE_URL,
"Content-Type": "application/x-www-form-urlencoded",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.9,id;q=0.8",
};
if (options.cookie) {
headers["Cookie"] = options.cookie;
}
const response = await fetch(`${FDOWN_BASE_URL}/download.php`, {
method: "POST",
headers,
body: formData.toString()
});
const html = await response.text();
// Deteksi jika server mendeteksi bot / challenge Turnstile
if (html.includes("Robot Check: Our system identified you as robot") || response.status === 403) {
return {
status: false,
code: 403,
creator: "vamxapi",
message: "FDown meminta verifikasi Cloudflare Turnstile. Gunakan session cookie browser atau gunakan alternatif downloader non-CF (seperti Downr)."
};
}
const $ = cheerio.load(html);
const title = $(".lib-row.lib-header").text().trim() || "Facebook Video";
const description = $(".lib-row.lib-desc").text().trim() || undefined;
const sdLink = $("#sdlink").attr("href");
const hdLink = $("#hdlink").attr("href");
const formats = [];
if (hdLink) {
formats.push({
quality: "HD (High Definition)",
extension: "mp4",
url: hdLink
});
}
if (sdLink) {
formats.push({
quality: "SD (Standard Definition)",
extension: "mp4",
url: sdLink
});
}
if (formats.length === 0) {
return {
status: false,
code: 404,
creator: "vamxapi",
message: "Video tidak ditemukan atau akun bersifat privat. Pastikan video bersifat publik."
};
}
return {
status: true,
code: 200,
creator: "vamxapi",
result: {
url: targetUrl,
title,
description,
hd: hdLink || null,
sd: sdLink || null,
formats
}
};
} catch (error) {
return {
status: false,
code: 500,
creator: "vamxapi",
message: error.message || "Terjadi kesalahan internal saat scraping FDown."
};
}
}
if (typeof module !== "undefined" && module.exports) {
module.exports = {
fdown,
downloadFacebook: fdown
};
}
// Eksekusi CLI jika dipanggil langsung
if (require.main === module) {
const args = process.argv.slice(2);
if (!args[0]) {
console.log("Usage: node fdown.js <URL_FACEBOOK>");
console.log("Contoh: node fdown.js https://www.facebook.com/watch/?v=10153231379946729");
process.exit(1);
}
fdown(args[0]).then(res => {
console.log(JSON.stringify(res, null, 2));
}).catch(err => {
console.error("Error:", err.message);
});
}