/** * Tikip (tikip.us) TikTok Account & Region Stalker API * Target: https://tikip.us * Author: Vamz Spectre (VamxAPI) * * Capabilities: * - Direct Profile Lookup: Stalk akun TikTok publik via username (@username atau username polos). * - Exact Region Detection: Deteksi akurat negara/region akun TikTok (current region, registered region, locked region). * - Emoji Country Flag: Otomatis generate emoji bendera negara berdasarkan ISO code (misal ID -> 🇮🇩, US -> 🇺🇸). * - Complete Profile Details: ID, SecUID, Nama, Username, Bio/Signature, Link Bio, Verified Status, Privacy Status, Language, Created Date (ISO & Timestamp). * - Complete Engagement Statistics: Followers, Following, Total Likes (dengan fix 32-bit integer overflow), Total Videos, Friends. * - High-Resolution Avatars: Direct CDN link ke avatar HD (1080x1080), Medium (720x720), dan Thumbnail (100x100). * - Pure Node.js Native HTTPS: Zero external npm dependencies, IPv4-safe network handling. * * Download & Run (1:1 Konsisten): * curl -sL "https://code.vamxapi.my.id/snippet/raw/tikip" -o tikip.js * * Usage: * # 1. Cek Region & Stalk Akun TikTok: * node tikip.js "tiktok" * node tikip.js "@khaby.lame" * node tikip.js "raffinagita1717" */ const https = require("https"); const http = require("http"); const { URL } = require("url"); const BACKEND_API_BASE = "https://shinyfrydgdghfdgdgmouse-a6de.issam1996kech.workers.dev/api/v1/profile"; /** * Generate flag emoji dari ISO 2-letter country code (misal ID -> 🇮🇩) */ function getFlagEmoji(countryCode) { if (!countryCode || typeof countryCode !== "string" || countryCode.length !== 2) return ""; const codePoints = countryCode .toUpperCase() .split("") .map(char => 127397 + char.charCodeAt(0)); return String.fromCodePoint(...codePoints); } /** * Native HTTPS Request helper (IPv4-forced, fast keep-alive) */ 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/124.0.0.0 Safari/537.36", "Accept": "application/json, text/plain, */*", "Accept-Language": "en-US,en;q=0.9", "Origin": "https://tikip.us", "Referer": "https://tikip.us/", ...options.headers }, timeout: options.timeout || 15000 }, (res) => { 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 }); } catch { resolve({ status: res.statusCode, headers: res.headers, raw: body }); } }); }); req.on("error", err => reject(new Error(`Tikip Request Error: ${err.message}`))); req.on("timeout", () => { req.destroy(); reject(new Error("Tikip Request Timeout (15s)")); }); if (options.body) req.write(options.body); req.end(); } catch (err) { reject(err); } }); } /** * Stalk Akun TikTok & Cek Region * @param {string} username - Username TikTok (boleh diawali @) */ async function checkTikTokRegion(username) { if (!username || typeof username !== "string" || !username.trim()) { throw new Error("Parameter username TikTok wajib diisi (contoh: 'tiktok' atau '@khaby.lame')"); } const cleanUsername = username.trim().replace(/^@+/, ""); if (!cleanUsername) { throw new Error("Username TikTok tidak valid"); } const apiUrl = `${BACKEND_API_BASE}?username=${encodeURIComponent(cleanUsername)}`; const res = await request(apiUrl); if (res.data && res.data.status === "error") { throw new Error(res.data.error || "Username TikTok tidak ditemukan atau tidak valid"); } if (!res.data || res.data.status !== "success" || !res.data.data || !res.data.data.user) { throw new Error("Gagal mengambil data akun TikTok dari Tikip"); } const rawUser = res.data.data.user; const rawStats = res.data.data.stats || {}; const regionCode = res.data.data.region || rawUser.current_region || null; const regionName = res.data.data.region_name || rawUser.current_region_name || null; // Fix 32-bit signed integer overflow pada heartCount TikTok let likes = rawStats.heartCount || 0; if (typeof likes === "number" && likes < 0) { likes = likes >>> 0; } // Parse createTime let createdAtIso = null; if (rawUser.createTime) { try { createdAtIso = new Date(rawUser.createTime * 1000).toISOString(); } catch {} } return { status: true, creator: "Vamz Spectre", data: { user: { id: rawUser.id || null, username: rawUser.uniqueId || cleanUsername, nickname: rawUser.nickname || null, sec_uid: rawUser.secUid || null, bio: rawUser.signature || null, bio_link: rawUser.bioLink ? rawUser.bioLink.link : null, verified: Boolean(rawUser.verified), private: Boolean(rawUser.privateAccount), language: rawUser.language || null, created_at: createdAtIso, created_timestamp: rawUser.createTime || null, profile_url: `https://www.tiktok.com/@${rawUser.uniqueId || cleanUsername}` }, region: { code: regionCode, country: regionName, flag: getFlagEmoji(regionCode), current_region: { code: rawUser.current_region || null, country: rawUser.current_region_name || null, flag: getFlagEmoji(rawUser.current_region) }, registered_region: { code: rawUser.registered_region || null, country: rawUser.registered_region_name || null, flag: getFlagEmoji(rawUser.registered_region) }, locked_region: { code: rawUser.locked_region || null, country: rawUser.locked_region_name || null, flag: getFlagEmoji(rawUser.locked_region) } }, stats: { followers: rawStats.followerCount || 0, following: rawStats.followingCount || 0, likes: likes, videos: rawStats.videoCount || 0, friends: rawStats.friendCount || 0 }, avatar: { hd: rawUser.avatarLarger || null, medium: rawUser.avatarMedium || null, thumb: rawUser.avatarThumb || null } } }; } // ========================================== // CLI Runner (1:1 Konsisten) // ========================================== if (require.main === module) { const args = process.argv.slice(2); const target = args[0]; if (!target || target.startsWith("-h") || target === "help") { console.log(JSON.stringify({ status: false, creator: "Vamz Spectre", message: "Tikip (tikip.us) TikTok Region Finder & Profile Stalker API", download: 'curl -sL "https://code.vamxapi.my.id/snippet/raw/tikip" -o tikip.js', usage: "node tikip.js ", examples: [ 'node tikip.js "tiktok"', 'node tikip.js "@khaby.lame"', 'node tikip.js "raffinagita1717"' ] }, null, 2)); process.exit(0); } checkTikTokRegion(target) .then(res => console.log(JSON.stringify(res, null, 2))) .catch(err => { console.error(JSON.stringify({ status: false, creator: "Vamz Spectre", error: err.message }, null, 2)); process.exit(1); }); } module.exports = { checkTikTokRegion, getFlagEmoji };