/** * Credit By Zx * Sumber Kode: https://whatsapp.com/channel/0029VbDLqe7EquiSF4STU13o * Note: Kalau Mau Di sher Lagi Minimal Credit atau sumber jangan di hapus dong * Website React WhatsApp Gratis: * https://react.v1.zfile.web.id/ */ /** Yang Mau Beli Akun Netflix, Top-Up game, Sunt1k S0Smed Bisa Ke Zix Store. https://zixstore.kiospremium.site/ Terimakasih 😍👀 */ /** * Stalker Tiktok * Source: https://ttviewer.net/ * * Ngambil Informasi Profile Tiktok Target * Dan Ngambil Top Video atau foto postingan target */ const BASE_URL = "https://ttviewer.net"; const DEFAULT_HEADERS = { "Accept": "application/json, text/plain, */*", "Content-Type": "application/json", "User-Agent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Mobile Safari/537.36", "Referer": "https://ttviewer.net/", }; const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); async function requestTtviewer(path, payload, { timeoutMs = 20000 } = {}) { const url = `${BASE_URL}${path}`; const res = await fetch(url, { method: "POST", headers: DEFAULT_HEADERS, body: JSON.stringify(payload), signal: AbortSignal.timeout(timeoutMs), }); if (!res.ok) { throw new Error(`HTTP ${res.status} ${res.statusText} - ${url}`); } const json = await res.json().catch(() => null); if (!json) { throw new Error("Response bukan JSON valid."); } if (json.code !== 0) { throw new Error(json.msg || `API error code: ${json.code}`); } return json; } function normalizeVideo(video) { return { id: video.video_id || video.aweme_id || null, title: video.title || "", region: video.region || null, created_at: video.create_time ? new Date(video.create_time * 1000).toISOString() : null, stats: { views: video.play_count ?? 0, likes: video.digg_count ?? 0, comments: video.comment_count ?? 0, shares: video.share_count ?? 0, downloads: video.download_count ?? 0, collects: video.collect_count ?? 0, }, media: { type: Array.isArray(video.images) && video.images.length > 0 ? "photo" : "video", cover: video.cover || null, images: video.images || [], play: video.play || null, duration: video.duration || 0, }, music: video.music_info ? { id: video.music_info.id || null, title: video.music_info.title || null, author: video.music_info.author || null, play: video.music_info.play || null, } : null, is_ad: video.is_ad || false, }; } async function stalkertiktok(username, options = {}) { const { includeVideos = true, count = 6, pages = 1, delayMs = 800, } = options; const unique_id = String(username || "") .trim() .replace(/^@/, ""); if (!unique_id) { throw new Error("Username TikTok tidak boleh kosong."); } const profileResponse = await requestTtviewer( "/api/tiktok/get-profile", { unique_id } ); const user = profileResponse?.data?.user || {}; const stats = profileResponse?.data?.stats || {}; const result = { username: user.uniqueId || unique_id, nickname: user.nickname || null, signature: user.signature || null, verified: user.verified || false, privateAccount: user.privateAccount || false, secUid: user.secUid || null, id: user.id || null, createTime: user.createTime ? new Date(user.createTime * 1000).toISOString() : null, avatar: { thumb: user.avatarThumb || null, medium: user.avatarMedium || null, larger: user.avatarLarger || null, }, stats: { following: stats.followingCount ?? 0, followers: stats.followerCount ?? 0, hearts: stats.heartCount ?? 0, videos: stats.videoCount ?? 0, diggs: stats.diggCount ?? 0, }, }; if (!includeVideos) { return result; } const videos = []; let cursor = 0; let hasMore = true; for (let page = 0; page < pages && hasMore; page++) { if (page > 0) { await sleep(delayMs); } try { const videosResponse = await requestTtviewer( "/api/tiktok/get-videos", { secUid: user.secUid, unique_id, count, cursor, } ); const data = videosResponse?.data || {}; const videoList = Array.isArray(data.videos) ? data.videos : []; videos.push(...videoList.map(normalizeVideo)); hasMore = Boolean(data.hasMore); cursor = data.cursor ?? 0; if (!hasMore) break; } catch (error) { result.videosError = error.message; break; } } result.videos = videos; return result; } module.exports = { stalkertiktok }; (async () => { try { const data = await stalkertiktok("yuukii3k", { includeVideos: true, count: 6, pages: 1, delayMs: 800, }); console.log(JSON.stringify(data, null, 2)); } catch (error) { console.error("Error:", error.message); } })();