/** * Bacon Bypass API Client & Scraper * Platform: https://baconbypass.xyz * Author: Vamz Spectre / VamxAPI * * Cara Instalasi Dependencies: * npm install axios * * Cara Download File Ini 1:1: * curl -sL "https://code.vamxapi.my.id/snippet/raw/bacon-bypass" -o bacon-bypass.js * * Contoh Penggunaan CLI: * node bacon-bypass.js --supported * node bacon-bypass.js "https://rekonise.com/pls-donate-script-xrews" "Bacon-APIKEY" * node bacon-bypass.js --check="Bacon-APIKEY" */ const axios = require('axios'); /** * Fungsi untuk bypass link menggunakan Bacon API atau Turnstile token * @param {Object} options * @param {string} options.url - Link target yang mau di-bypass * @param {string} [options.apikey] - Bacon API Key (jika punya) * @param {string} [options.turnstileToken] - Cloudflare Turnstile token2 dari frontend */ async function baconBypass({ url, apikey, turnstileToken }) { if (!url) { return { status: false, message: 'Parameter "url" wajib disertakan!' }; } // 1. Jalur REST API Resmi (Memerlukan API Key) if (apikey) { try { const res = await axios.post('https://api.baconbypass.xyz/bypass', { url, apikey }, { headers: { 'Content-Type': 'application/json', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' }, timeout: 20000 }); return { status: true, source: 'api.baconbypass.xyz', data: res.data }; } catch (e) { return { status: false, source: 'api.baconbypass.xyz', error: e.response?.data || e.message }; } } // 2. Jalur Frontend Web (Menggunakan Cloudflare Turnstile Token) if (turnstileToken) { try { const res = await axios.post('https://baconbypass.xyz/api/bypass', { url, token2: turnstileToken }, { headers: { 'Content-Type': 'application/json', 'Origin': 'https://baconbypass.xyz', 'Referer': 'https://baconbypass.xyz/', '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' }, timeout: 25000 }); return { status: true, source: 'baconbypass.xyz/api/bypass', data: res.data }; } catch (e) { return { status: false, source: 'baconbypass.xyz/api/bypass', error: e.response?.data || e.message }; } } // 3. Fallback info & list supported check try { const sup = await axios.get('https://api.baconbypass.xyz/supported', { timeout: 10000 }); const targetDomain = new URL(url).hostname; const isSupported = Array.isArray(sup.data?.supported) && sup.data.supported.some(d => targetDomain.includes(d)); return { status: false, message: 'Bacon Bypass mewajibkan "apikey" (Bacon-xxx) atau "turnstileToken" (Cloudflare Turnstile token2).', info: { targetUrl: url, targetDomain, isSupportedByBacon: isSupported, totalSupportedDomains: sup.data?.total || 65, turnstileSiteKey: '0x4AAAAAADDXjORX_B-3cIrZ', howToUse: { cliWithApiKey: 'node bacon-bypass.js "https://rekonise.com/..." "Bacon-APIKEY"', cliCheckSupported: 'node bacon-bypass.js --supported', cliCheckKey: 'node bacon-bypass.js --check="Bacon-APIKEY"' } } }; } catch (err) { return { status: false, message: err.message }; } } /** * Mengambil daftar 65 domain yang disupport oleh Bacon Bypass */ async function getSupportedDomains() { const res = await axios.get('https://api.baconbypass.xyz/supported', { timeout: 10000 }); return res.data; } /** * Mengecek masa berlaku dan sisa kuota API Key Bacon */ async function checkApiKey(key) { if (!key) return { status: false, message: 'Key wajib disertakan' }; try { const res = await axios.get(`https://api.baconbypass.xyz/check-expired?key=${encodeURIComponent(key)}`); return res.data; } catch (e) { return { status: false, error: e.response?.data || e.message }; } } // Module export module.exports = { baconBypass, getSupportedDomains, checkApiKey }; // CLI Runner Langsung if (require.main === module) { const arg1 = process.argv[2]; if (!arg1) { console.log(JSON.stringify({ status: false, message: 'Gunakan: node bacon-bypass.js [apikey] atau node bacon-bypass.js --supported' }, null, 2)); process.exit(0); } (async () => { try { if (arg1 === '--supported') { const res = await getSupportedDomains(); console.log(JSON.stringify(res, null, 2)); } else if (arg1.startsWith('Bacon-') || arg1.startsWith('--check=')) { const key = arg1.replace('--check=', ''); const res = await checkApiKey(key); console.log(JSON.stringify(res, null, 2)); } else { const key = process.argv[3]; const res = await baconBypass({ url: arg1, apikey: key }); console.log(JSON.stringify(res, null, 2)); } } catch (err) { console.error(JSON.stringify({ status: false, error: err.message }, null, 2)); } })(); }