/** * StalkML - Mobile Legends Player Stalker & Account Validator * Author: Vamz Spectre (VamxAPI) * * Fitur: * - Validasi ID & Server (Zone ID) Mobile Legends: Bang Bang secara real-time * - Mengekstrak nama in-game resmi (user) dan User ID Mobile Legends * - Multi-Engine Gateway Fallback: * 1. Primary: MLBB High-Speed Realtime Inquiry (~15-30ms) * 2. Secondary: Global Game Nickname Resolver (~30-50ms) * 3. Tertiary: GoPay Official Game Inquiry Engine (~50ms) * - Zero Dependencies: Berjalan langsung menggunakan Node.js native HTTPS (IPv4 safe) * - Fleksibel parsing input: "ID Zone", "ID(Zone)", "ID|Zone", atau 2 argumen terpisah * - Output format JSON murni & konsisten: { user, id, zoneId } * * Penggunaan CLI: * curl -sL "https://code.vamxapi.my.id/snippet/raw/stalkml" -o stalkml.js * node stalkml.js 1114917746 13486 * node stalkml.js "1114917746(13486)" */ const https = require("https"); const http = require("http"); const { URL } = require("url"); /** * Lightweight native HTTP/HTTPS client (IPv4 forced, auto redirect, fast keepalive) */ function request(urlStr, options = {}) { return new Promise((resolve, reject) => { try { const parsed = new URL(urlStr); const isHttps = parsed.protocol === "https:"; const client = isHttps ? https : http; const req = client.request(parsed, { method: options.method || "GET", family: 4, headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36", Accept: "application/json, text/plain, */*", ...options.headers, }, timeout: options.timeout || 6000, }, (res) => { if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) { const redirectUrl = new URL(res.headers.location, urlStr).toString(); return resolve(request(redirectUrl, options)); } const chunks = []; res.on("data", chunk => chunks.push(chunk)); res.on("end", () => { const body = Buffer.concat(chunks).toString("utf-8"); try { const json = JSON.parse(body); resolve({ status: res.statusCode, headers: res.headers, data: json, raw: body }); } catch { resolve({ status: res.statusCode, headers: res.headers, data: null, raw: body }); } }); }); req.on("error", err => reject(new Error(`StalkML Request Error: ${err.message}`))); req.on("timeout", () => { req.destroy(); reject(new Error("StalkML Request Timeout")); }); if (options.body) req.write(options.body); req.end(); } catch (err) { reject(err); } }); } /** * Parsing input menjadi ID dan Zone ID * @param {string} rawId * @param {string} [rawZone] * @returns {{ id: string, zoneId: string } | null} */ function parseMlInput(rawId, rawZone) { if (!rawId) return null; const str = String(rawId).trim(); // Format ID(Zone) atau ID [Zone] const matchParentheses = str.match(/^([0-9]{4,12})\s*[\(\[\{]([0-9]{3,8})[\)\]\}]$/); if (matchParentheses) { return { id: matchParentheses[1], zoneId: matchParentheses[2] }; } // Format ID|Zone, ID/Zone, ID Zone, dll const matchDelimited = str.match(/^([0-9]{4,12})[\s\|\/\-_,:;]+([0-9]{3,8})$/); if (matchDelimited) { return { id: matchDelimited[1], zoneId: matchDelimited[2] }; } // Parameter kedua terpisah if (rawZone) { const id = String(rawId).replace(/[^0-9]/g, "").trim(); const zoneId = String(rawZone).replace(/[^0-9]/g, "").trim(); if (id && zoneId) return { id, zoneId }; } return null; } /** * Main scraper function: Stalk akun Mobile Legends * Output: { user, id, zoneId } * @param {string} id - User ID Mobile Legends atau gabungan ID(Zone) * @param {string} [zoneId] - Server / Zone ID Mobile Legends * @returns {Promise} */ async function stalkml(id, zoneId) { const parsed = parseMlInput(id, zoneId); if (!parsed) { return { status: false, creator: "Vamz Spectre", message: "Format input tidak valid. Masukkan ID dan Zone ID (contoh: 1114917746 13486 atau 1114917746(13486)).", }; } const { id: cleanId, zoneId: cleanZone } = parsed; // 1. Engine 1: Primary MLBB Inquiry Gateway (~15-30ms) try { const res = await request( `https://mlbb-api.isan.eu.org/find?id=${encodeURIComponent(cleanId)}&zone=${encodeURIComponent(cleanZone)}`, { timeout: 3500 } ); if (res.data?.success && res.data?.name) { const nickname = String(res.data.name).trim(); return { status: true, creator: "Vamz Spectre", data: { user: nickname, id: cleanId, zoneId: cleanZone, }, }; } if (res.data?.success === false && res.data?.message?.toLowerCase().includes("not found")) { return { status: false, creator: "Vamz Spectre", message: `Akun Mobile Legends dengan ID ${cleanId} (${cleanZone}) tidak ditemukan atau tidak valid.`, }; } } catch (err) {} // 2. Engine 2: Secondary Global Game Resolver (~30-50ms) try { const res = await request( `https://api.isan.eu.org/nickname/ml?id=${encodeURIComponent(cleanId)}&zone=${encodeURIComponent(cleanZone)}`, { timeout: 3500 } ); if (res.data?.success && res.data?.name) { const nickname = String(res.data.name).trim(); return { status: true, creator: "Vamz Spectre", data: { user: nickname, id: cleanId, zoneId: cleanZone, }, }; } if (res.data?.success === false && res.data?.message?.toLowerCase().includes("not found")) { return { status: false, creator: "Vamz Spectre", message: `Akun Mobile Legends dengan ID ${cleanId} (${cleanZone}) tidak ditemukan atau tidak valid.`, }; } } catch (err) {} // 3. Engine 3: Official GoPay Games Inquiry Gateway (~50ms) try { const res = await request( "https://gopay.co.id/games/v1/order/user-account", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ code: "MOBILE_LEGENDS", data: { userId: cleanId, zoneId: cleanZone, }, }), timeout: 4000, } ); const data = res.data?.data; if (data && data.username) { const nickname = decodeURIComponent(String(data.username).replace(/\+/g, " ")).trim(); return { status: true, creator: "Vamz Spectre", data: { user: nickname, id: cleanId, zoneId: cleanZone, }, }; } if ( res.status === 404 || res.data?.message?.toLowerCase()?.includes("not recognized") ) { return { status: false, creator: "Vamz Spectre", message: `Akun Mobile Legends dengan ID ${cleanId} (${cleanZone}) tidak ditemukan atau tidak valid.`, }; } } catch (err) {} return { status: false, creator: "Vamz Spectre", message: `Akun Mobile Legends dengan ID ${cleanId} (${cleanZone}) tidak ditemukan atau server game sedang sibuk.`, }; } module.exports = { stalkml }; // CLI Execution if (require.main === module) { let arg1 = process.argv[2]; let arg2 = process.argv[3]; if (!arg1) { arg1 = "1114917746"; arg2 = "13486"; } stalkml(arg1, arg2) .then((res) => console.log(JSON.stringify(res, null, 2))) .catch((err) => { console.error( JSON.stringify( { status: false, creator: "Vamz Spectre", message: err.message || "Terjadi kesalahan internal.", }, null, 2 ) ); process.exit(1); }); }