/** * BaconBossScript Scraper * Author: Vamz Spectre / VamxAPI * Target: https://baconbossscript.com * * Download: * curl -sL "https://code.vamxapi.my.id/snippet/raw/baconboss" -o baconboss.js * * Usage: * node baconboss.js "latest" * node baconboss.js "blox" * node baconboss.js "free-ugc-make-it-fashion-op-script-instant-2-ugc-pastebin-4ljot" * node baconboss.js "beecon-hub" */ const axios = require("axios"); const cheerio = require("cheerio"); const crypto = require("crypto"); const BASE_URL = "https://baconbossscript.com"; 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", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.9", }; /** * Parse script catalog items and pagination from HTML */ function parseScriptList(html, currentPage = 1) { const $ = cheerio.load(html); const items = []; $("a[href^=\"/scripts/\"]").each((_, el) => { const $el = $(el); const href = $el.attr("href") || ""; const slug = href.replace(/^\/scripts\//, "").replace(/\/$/, ""); const title = $el.find("h3").text().trim(); const thumbnail = $el.find("img").attr("src") || ""; const viewsText = $el.find("span").filter((_, s) => $(s).text().includes("views")).text().trim(); const views = parseInt(viewsText.replace(/\D+/g, ""), 10) || 0; if (slug && title) { items.push({ title, slug, url: `${BASE_URL}/scripts/${slug}`, thumbnail, views }); } }); let totalPages = currentPage; $("nav[aria-label=\"Script pages\"] a").each((_, el) => { const pageNum = parseInt($(el).text().trim(), 10); if (!isNaN(pageNum) && pageNum > totalPages) { totalPages = pageNum; } }); return { currentPage: Number(currentPage), totalPages, totalFound: items.length, scripts: items }; } /** * Fetch latest scripts */ async function latest(page = 1) { try { const { data: html } = await axios.get(`${BASE_URL}/?page=${page}`, { headers: DEFAULT_HEADERS, timeout: 10000 }); const parsed = parseScriptList(html, page); return { status: true, creator: "Vamz Spectre", type: "latest", ...parsed }; } catch (err) { return { status: false, creator: "Vamz Spectre", error: err.message || "Failed to fetch latest scripts" }; } } /** * Search scripts by query */ async function search(query, page = 1) { try { const encoded = encodeURIComponent(query); const { data: html } = await axios.get(`${BASE_URL}/?q=${encoded}&page=${page}`, { headers: DEFAULT_HEADERS, timeout: 10000 }); const parsed = parseScriptList(html, page); return { status: true, creator: "Vamz Spectre", type: "search", query, ...parsed }; } catch (err) { return { status: false, creator: "Vamz Spectre", error: err.message || "Failed to search scripts" }; } } /** * Get script detail by slug or URL */ async function detail(slugOrUrl) { try { const slug = slugOrUrl .replace(/^https?:\/\/[^\/]+\/scripts\//, "") .replace(/^\/scripts\//, "") .replace(/\/$/, ""); const targetUrl = `${BASE_URL}/scripts/${slug}`; const { data: html } = await axios.get(targetUrl, { headers: DEFAULT_HEADERS, timeout: 10000 }); const $ = cheerio.load(html); const title = $("h1").text().trim(); const thumbnail = $("main img").attr("src") || ""; // Extract views const viewsMatch = html.match(/(\d+) views/) || html.match(/\[(\d+),\\" views\\\"\]/); const views = viewsMatch ? parseInt(viewsMatch[1], 10) : 0; // Extract scriptId from Next.js RSC payload const idMatch = html.match(/\\"scriptId\\":\\"([a-f0-9\-]+)\\"/); const scriptId = idMatch ? idMatch[1] : null; // Extract youtubeUrl const ytMatch = html.match(/\\"youtubeUrl\\":\\"([^"\\]+)\\"/); const youtubeUrl = ytMatch ? ytMatch[1] : null; // Extract unlockProviders let unlockProviders = []; const provMatch = html.match(/\\"unlockProviders\\":(\[.*?\])/); if (provMatch) { try { unlockProviders = JSON.parse(provMatch[1].replace(/\\"/g, '"')); } catch (_) {} } if (unlockProviders.length === 0) { const modeMatch = html.match(/\\"unlockProviderMode\\":\\"([^"\\]+)\\"/); if (modeMatch) { unlockProviders = modeMatch[1].split(",").map(p => p.trim()); } } // Generate unlock session link if scriptId is available let unlockSession = null; if (scriptId && unlockProviders.length > 0) { const clientProof = crypto.randomBytes(16).toString("hex"); for (const prov of unlockProviders) { try { const { data: sessionData } = await axios.post( `${BASE_URL}/api/scripts/${scriptId}/unlock-session`, { provider: prov, clientProof }, { headers: { "Content-Type": "application/json", ...DEFAULT_HEADERS }, timeout: 7000 } ); if (sessionData && sessionData.success) { unlockSession = { provider: sessionData.provider, sessionId: sessionData.sessionId, destinationUrl: sessionData.linkUrl }; break; } } catch (_) {} } } return { status: true, creator: "Vamz Spectre", result: { title, slug, url: targetUrl, scriptId, thumbnail, views, youtubeUrl, unlockProviders, unlockSession } }; } catch (err) { return { status: false, creator: "Vamz Spectre", error: err.message || "Failed to fetch script detail" }; } } /** * Get Beecon Hub main product info */ async function beeconHub() { try { const { data: html } = await axios.get(`${BASE_URL}/beecon-hub`, { headers: DEFAULT_HEADERS, timeout: 10000 }); const $ = cheerio.load(html); const title = $("title").text().trim(); const description = $("meta[name=\"description\"]").attr("content") || ""; const steps = []; $("ol li").each((_, el) => { const num = $(el).find("span").first().text().trim(); const text = $(el).find("span").last().text().trim(); if (text) steps.push({ step: num, instruction: text }); }); let downloadUrl = null; $("a[href*=\"direct-link.net\"]").each((_, el) => { downloadUrl = $(el).attr("href"); }); let youtubeGuide = null; $("a[href*=\"youtube.com\"]").each((_, el) => { youtubeGuide = $(el).attr("href"); }); return { status: true, creator: "Vamz Spectre", result: { title, description, downloadUrl, youtubeGuide, discord: "https://discord.gg/xUvY22gZp4", quickStart: steps } }; } catch (err) { return { status: false, creator: "Vamz Spectre", error: err.message || "Failed to fetch Beecon Hub info" }; } } // Module export module.exports = { latest, search, detail, beeconHub }; // CLI Execution Runner if (require.main === module) { (async () => { const arg = process.argv[2] ? process.argv[2].trim() : "latest"; let res; if (arg === "beecon-hub" || arg === "beecon") { res = await beeconHub(); } else if (arg.startsWith("http://") || arg.startsWith("https://") || arg.includes("-op-script-") || arg.includes("-pastebin-")) { res = await detail(arg); } else if (arg === "latest") { const page = process.argv[3] || 1; res = await latest(page); } else { const page = process.argv[3] || 1; res = await search(arg, page); } console.log(JSON.stringify(res, null, 2)); })(); }