/** * ======================================================== * Name: CineSubz Movie, TV Shows & Stream Download Scraper * * Cara Download: * curl -sL "https://code.vamxapi.my.id/snippet/raw/cinesubz-movie-scraper" -o cinesubz-movie-scraper.js * * Cara Eksekusi: * node cinesubz-movie-scraper.js search "Spider-Man" * node cinesubz-movie-scraper.js detail "https://cinesubz.net/movies/spider-man-brand-new-day-2026-sinhala-subtitles/" * node cinesubz-movie-scraper.js latest movies 1 * node cinesubz-movie-scraper.js resolve "https://cinesubz.net/zt-links/nvm2e3d9ep/" * * Author: Vamz Spectre * Source: https://vamxapi.my.id * ======================================================== */ const BASE_URL = "https://cinesubz.net"; const DEFAULT_HEADERS = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36", Accept: "text/html,application/json,*/*", "Accept-Language": "en-US,en;q=0.9", }; const URL_MAPPINGS = [ { search: ["https://google.com/server11/1:/", "https://google.com/server12/1:/", "https://google.com/server13/1:/"], replace: "https://drive.csplayer2.space/server1/" }, { search: ["https://google.com/server21/1:/", "https://google.com/server22/1:/", "https://google.com/server23/1:/"], replace: "https://drive.csplayer2.space/server2/" }, { search: ["https://google.com/server3/1:/"], replace: "https://drive.csplayer2.space/server3/" }, { search: ["https://google.com/server4/1:/"], replace: "https://drive.csplayer2.space/server4/" }, { search: ["https://google.com/server5/1:/"], replace: "https://drive.csplayer2.space/server5/" }, { search: ["https://google.com/server6/"], replace: "https://drive.csplayer2.space/server6/" }, { search: ["https://google.com/server7/"], replace: "https://drive.csplayer2.space/server7/" } ]; let cachedNonce = null; let nonceExpires = 0; /** * Ambil fresh security nonce dari frontend Zetaflix */ async function getNonce() { const now = Date.now(); if (cachedNonce && now < nonceExpires) { return cachedNonce; } try { const res = await fetch(BASE_URL, { headers: DEFAULT_HEADERS }); const html = await res.text(); const match = html.match(/var ztGo\s*=\s*({[^;]+});/); if (match) { const obj = JSON.parse(match[1]); if (obj.nonce) { cachedNonce = obj.nonce; nonceExpires = now + 15 * 60 * 1000; return cachedNonce; } } } catch {} return "11c13d6e10"; } /** * 1. Search Movie / TV Shows */ async function search(query) { const cleanQ = (query || "").trim(); if (!cleanQ) throw new Error("Query pencarian tidak boleh kosong!"); const nonce = await getNonce(); const searchUrl = `${BASE_URL}/wp-json/zetaflix/search/?keyword=${encodeURIComponent(cleanQ)}&nonce=${nonce}`; const res = await fetch(searchUrl, { headers: DEFAULT_HEADERS }); if (!res.ok) throw new Error(`Pencarian gagal: HTTP ${res.status}`); const data = await res.json(); if (data.error) throw new Error(data.title || "Gagal melakukan pencarian"); const results = Object.entries(data) .map(([id, item]) => { const genres = item.extra?.genres ? item.extra.genres.split(",").map(g => g.trim()) : []; const isAdult = genres.some(g => g.toLowerCase() === "18" || g.toLowerCase() === "18+"); return { id, title: item.title, url: item.url, thumbnail: item.img, genres, year: item.extra?.date || null, imdb_rating: item.extra?.imdb || null, runtime: item.extra?.runtime ? item.extra.runtime.replace(/tt\d+\s*/, "") : null, is_adult: isAdult }; }) .filter(item => !item.is_adult); return { status: true, query: cleanQ, total: results.length, results }; } /** * 2. Get Latest Movies or TV Shows */ async function getLatest(type = "movies", page = 1) { const targetType = type === "tvshows" ? "tvshows" : "movies"; const url = page > 1 ? `${BASE_URL}/${targetType}/page/${page}/` : `${BASE_URL}/${targetType}/`; const res = await fetch(url, { headers: DEFAULT_HEADERS }); if (!res.ok) throw new Error(`Gagal mengambil data katalog: HTTP ${res.status}`); const html = await res.text(); const items = []; const regex = /
([\s\S]*?)<\/p>/i);
const synopsis = synopsisMatch ? synopsisMatch[1].replace(/<[^>]+>/g, "").trim() : "";
// Parse Metadata
const imdbMatch = html.match(/IMDb:\s*([\d.]+)/i);
const qualityMatch = html.match(/]*class=["']data-quality["'][^>]*>([\s\S]*?)<\/span>/i);
const genreMatch = html.match(/