/** * MovieZone - Film & Series Streaming Engine * Scraped & Reverse-Engineered from https://www.rizky.web.id/ * * @author Vamz Spectre (https://vamxapi.my.id) * * Download: * curl -sL "https://code.vamxapi.my.id/snippet/raw/moviezone-scraper" -o moviezone-scraper.js * * Usage: * node moviezone-scraper.js "Spider-Man" * node moviezone-scraper.js "movie-969681" * node moviezone-scraper.js "tv-123542" 1 * node moviezone-scraper.js trending */ const https = require("https"); const BASE_URL = "https://www.rizky.web.id"; /** * Helper HTTP GET Request JSON * @param {string} url */ function fetchJson(url) { return new Promise((resolve, reject) => { const req = https.get( url, { 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: "application/json", Referer: BASE_URL + "/", }, }, (res) => { let body = ""; res.on("data", (chunk) => (body += chunk)); res.on("end", () => { try { resolve(JSON.parse(body)); } catch (e) { reject(new Error(`Invalid JSON Response (${res.statusCode}): ${body.slice(0, 100)}`)); } }); } ); req.on("error", reject); }); } /** * Generator server direct stream embed (VidSrc, SuperEmbed, 2Embed, VidLink, dll) */ function getEmbedServers(tmdbId, isTv = false, season = 1, episode = 1, imdbId = "") { const S = season || 1; const E = episode || 1; if (isTv) { return [ { server: "VidSrcWiki", url: `https://vidsrc.wiki/embed/tv/${tmdbId}/${S}/${E}` }, { server: "SuperEmbed", url: `https://multiembed.mov/?video_id=${tmdbId}&tmdb=1&s=${S}&e=${E}` }, { server: "VidSrc", url: `https://vidsrc.to/embed/tv/${tmdbId}/${S}/${E}` }, { server: "VidLink", url: `https://vidlink.pro/tv/${tmdbId}/${S}/${E}` }, { server: "2Embed", url: `https://www.2embed.cc/embedtv/${tmdbId}&s=${S}&e=${E}` }, { server: "VSEmbed", url: `https://vsembed.ru/embed/tv/${imdbId || tmdbId}/${S}/${E}` }, { server: "VidFast", url: `https://vidfast.vc/tv/${tmdbId}/${S}/${E}` }, ]; } else { return [ { server: "VidSrcWiki", url: `https://vidsrc.wiki/embed/movie/${tmdbId}` }, { server: "SuperEmbed", url: `https://multiembed.mov/?video_id=${tmdbId}&tmdb=1` }, { server: "VidSrc", url: `https://vidsrc.to/embed/movie/${tmdbId}` }, { server: "VidLink", url: `https://vidlink.pro/movie/${tmdbId}` }, { server: "2Embed", url: `https://www.2embed.cc/embed/${tmdbId}` }, { server: "VSEmbed", url: `https://vsembed.ru/embed/movie/${imdbId || tmdbId}` }, { server: "VidFast", url: `https://vidfast.vc/movie/${tmdbId}` }, ]; } } /** * Cari film atau serial TV berdasarkan judul * @param {string} query * @param {number} page */ async function searchMovies(query, page = 1) { const url = `${BASE_URL}/api/search?q=${encodeURIComponent(query)}&page=${page}`; const res = await fetchJson(url); return { status: res.status || true, query, page: res.page || page, total: res.total || res.results?.length || 0, results: res.results || [], }; } /** * Ambil daftar film/series berdasarkan kategori * @param {"trending"|"latest"|"upcoming"|"toprated"} kind * @param {"all"|"movie"|"tv"} type */ async function getList(kind = "trending", type = "all") { const url = `${BASE_URL}/api/list?kind=${encodeURIComponent(kind)}&type=${encodeURIComponent(type)}`; const res = await fetchJson(url); return { status: res.status || true, kind, type, total: res.total || res.results?.length || 0, results: res.results || [], }; } /** * Ambil informasi lengkap film / serial beserta link streaming dan embed player * @param {string} slug Contoh: "movie-969681" atau "tv-123542" */ async function getDetail(slug) { const url = `${BASE_URL}/api/detail?slug=${encodeURIComponent(slug)}`; const res = await fetchJson(url); if (!res.status || !res.data) { return { status: false, message: "Film atau Series tidak ditemukan." }; } const data = res.data; const isTv = data.type === "Series" || slug.startsWith("tv-"); const tmdbId = data.id; const imdbId = data.imdbId || ""; // Pastikan list server streaming terisi lengkap const streamServers = getEmbedServers(tmdbId, isTv, 1, 1, imdbId); return { status: true, data: { ...data, stream: { primaryIframe: streamServers[0].url, servers: streamServers, }, }, }; } /** * Ambil daftar episode per season untuk serial TV * @param {string} slug Contoh: "tv-123542" * @param {number} season Nomor season (default: 1) */ async function getEpisodes(slug, season = 1) { const url = `${BASE_URL}/api/episodes?slug=${encodeURIComponent(slug)}&season=${season}`; const res = await fetchJson(url); if (!res.status || !res.results) { return { status: false, message: "Episode tidak ditemukan atau season tidak valid." }; } const tmdbIdMatch = slug.match(/tv-(\d+)/); const tmdbId = tmdbIdMatch ? tmdbIdMatch[1] : null; const enrichedEpisodes = (res.results || []).map((ep) => { return { ...ep, streamServers: tmdbId ? getEmbedServers(tmdbId, true, season, ep.episode) : [], }; }); return { status: true, slug, season, totalEpisodes: enrichedEpisodes.length, results: enrichedEpisodes, }; } // CLI Runner Support if (require.main === module) { (async () => { try { const arg1 = process.argv[2] || "trending"; const arg2 = process.argv[3]; let result; if (arg1 === "trending" || arg1 === "latest" || arg1 === "upcoming" || arg1 === "toprated") { result = await getList(arg1, arg2 || "all"); } else if (arg1.startsWith("tv-") && arg2 && !isNaN(parseInt(arg2, 10))) { // Episode viewer result = await getEpisodes(arg1, parseInt(arg2, 10)); } else if (arg1.startsWith("movie-") || arg1.startsWith("tv-")) { // Direct detail lookup result = await getDetail(arg1); } else { // Default search query result = await searchMovies(arg1); } console.log(JSON.stringify(result, null, 2)); } catch (err) { console.error(JSON.stringify({ status: false, error: err.message }, null, 2)); process.exit(1); } })(); } module.exports = { searchMovies, getList, getDetail, getEpisodes, getEmbedServers, };