#!/usr/bin/env node /** * NontonAnimeID - Anime Streaming & Metadata Scraper * Creator: SAURUS * Base: https://s13.nontonanimeid.boats * Saluran: https://whatsapp.com/channel/0029VbDhTC6KLaHjHKXl552C * Note: pliss guys jangan di klaim 100% buatan lu, lu boleh kok modifikasi trs share lagi tapi tolong jangan ilangin header creator sama ch-nya */ 'use strict'; const BASE_URL = 'https://s13.nontonanimeid.boats'; const CREATOR = 'SAURUS'; const SALURAN = 'https://whatsapp.com/channel/0029VbDhTC6KLaHjHKXl552C'; const 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'; async function request(url, options = {}) { const { method = 'GET', headers = {}, body = undefined, timeout = 15000 } = options; const res = await fetch(url, { method, headers: { 'User-Agent': USER_AGENT, 'Accept': 'text/html,application/xhtml+xml,application/json;q=0.9,*/*;q=0.8', 'Accept-Language': 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7', ...headers }, body, signal: AbortSignal.timeout(timeout) }); if (!res.ok) { throw new Error(`HTTP ${res.status} on ${url}`); } return await res.text(); } function cleanText(text = '') { return text .replace(/]*dashicons[^>]*>[\s\S]*?<\/span>/gi, '') .replace(/<[^>]+>/g, ' ') .replace(/–/g, '–') .replace(/’/g, "'") .replace(/&/g, '&') .replace(/"/g, '"') .replace(/'/g, "'") .replace(/</g, '<') .replace(/>/g, '>') .replace(/\s+/g, ' ') .trim(); } /** * 1. Ambil episode rilisan terbaru di Homepage (Episode Terbaru) */ async function latest(page = 1) { const url = page > 1 ? `${BASE_URL}/page/${page}/` : `${BASE_URL}/`; const html = await request(url); const results = []; // Prioritas 1: Ambil section "Episode Terbaru" (
) const articles = [...html.matchAll(/]*class=["']([^"']*animeseries[^"']*)["'][^>]*>([\s\S]*?)<\/article>/gi)]; for (const a of articles) { const block = a[2]; const linkMatch = block.match(/]*href=["']([^"']+)["']/i); const imgMatch = block.match(/]*src=["']([^"']+)["']/i); const titleMatch = block.match(/class=["'][^"']*entry-title[^"']*["'][^>]*>([\s\S]*?)<\/h3>/i) || block.match(/alt=["']([^"']+)["']/i) || block.match(/data-title-default=["']([^"']+)["']/i); // Ekstrak nomor episode di dalam span types episodes const epMatch = block.match(/class=["'][^"']*types\s+episodes[^"']*["'][^>]*>(?:<[^>]+>)*\s*(\d+)/i) || block.match(/class=["'][^"']*types\s+episodes[^"']*["'][^>]*>([\s\S]*?)<\/div>/i); if (linkMatch && linkMatch[1]) { let episodeStr = null; if (epMatch) { const epVal = epMatch[1] ? cleanText(epMatch[1]) : ''; if (epVal) episodeStr = `Episode ${epVal.replace(/^Episode\s+/i, '')}`; } results.push({ title: titleMatch ? cleanText(titleMatch[1]) : null, url: linkMatch[1], poster: imgMatch ? imgMatch[1] : null, episode: episodeStr, type: 'Anime' }); } } // Prioritas 2 (Fallback): Jika di halaman pagination bukan article melainkan div.animeseries if (results.length === 0) { const cardMatches = [...html.matchAll(/]*class=["'][^"']*animeseries[^"']*["'][^>]*>([\s\S]*?)<\/div>\s*<\/div>/gi)]; for (const card of cardMatches) { const block = card[1]; const linkMatch = block.match(/]*href=["']([^"']+)["']/i); const imgMatch = block.match(/]*src=["']([^"']+)["']/i); const titleMatch = block.match(/data-title-default=["']([^"']+)["']/i) || block.match(/alt=["']([^"']+)["']/i) || block.match(/]*>([\s\S]*?)<\/h4>/i); const scoreMatch = block.match(/class=["'][^"']*kotakscore[^"']*["'][^>]*>([\s\S]*?)<\/span>/i); if (linkMatch && linkMatch[1]) { results.push({ title: titleMatch ? cleanText(titleMatch[1]) : null, url: linkMatch[1], poster: imgMatch ? imgMatch[1] : null, score: scoreMatch ? cleanText(scoreMatch[1]) : null, type: 'Anime' }); } } } return { Creator: CREATOR, Saluran: SALURAN, status: true, page, total: results.length, results }; } /** * 2. Pencarian anime berdasarkan kata kunci */ async function search(query) { if (!query) throw new Error('Query pencarian diperlukan'); const url = `${BASE_URL}/?s=${encodeURIComponent(query)}`; const html = await request(url); const results = []; const cards = [...html.matchAll(/([\s\S]*?)<\/a>/gi)]; for (const c of cards) { const itemUrl = c[2]; const inner = c[4]; const titleMatch = inner.match(/]*class=["'][^"']*as-anime-title[^"']*["'][^>]*>([\s\S]*?)<\/h3>/i) || c[0].match(/data-title-default=["']([^"']+)["']/i) || c[0].match(/alt=["']([^"']+)["']/i); const imgMatch = inner.match(/]*src=["']([^"']+)["']/i); const ratingMatch = inner.match(/]*class=["'][^"']*as-rating[^"']*["'][^>]*>([\s\S]*?)<\/span>/i); const typeMatch = inner.match(/]*class=["'][^"']*as-type[^"']*["'][^>]*>([\s\S]*?)<\/span>/i); const seasonMatch = inner.match(/]*class=["'][^"']*as-season[^"']*["'][^>]*>([\s\S]*?)<\/span>/i); const synopsisMatch = inner.match(/]*class=["'][^"']*as-synopsis[^"']*["'][^>]*>([\s\S]*?)<\/p>/i); const genres = [...inner.matchAll(/]*class=["'][^"']*as-genre-tag[^"']*["'][^>]*>([\s\S]*?)<\/span>/gi)] .map(m => cleanText(m[1])); results.push({ title: titleMatch ? cleanText(titleMatch[1]) : null, url: itemUrl, poster: imgMatch ? imgMatch[1] : null, rating: ratingMatch ? cleanText(ratingMatch[1]).replace(/⭐/g, '').trim() : null, type: typeMatch ? cleanText(typeMatch[1]).replace(/📺/g, '').trim() : null, season: seasonMatch ? cleanText(seasonMatch[1]).replace(/📅/g, '').trim() : null, genres, synopsis: synopsisMatch ? cleanText(synopsisMatch[1]) : null }); } return { Creator: CREATOR, Saluran: SALURAN, status: true, query, total: results.length, results }; } /** * 3. Detail anime & daftar seluruh episode */ async function detail(urlOrSlug) { const url = urlOrSlug.startsWith('http') ? urlOrSlug : `${BASE_URL}/anime/${urlOrSlug.replace(/^\/anime\//, '').replace(/\/$/, '')}/`; const html = await request(url); const titleMatch = html.match(/]*>([\s\S]*?)<\/h1>/i); const title = titleMatch ? cleanText(titleMatch[1]).replace(/^Nonton\s+/i, '').replace(/\s+Sub\s+Indo$/i, '') : null; const posterMatch = html.match(/]*property=["']og:image["'][^>]*content=["']([^"']+)["']/i) || html.match(/class=["'][^"']*poster[^"']*["'][^>]*>[\s\S]*?]*src=["']([^"']+)["']/i); const poster = posterMatch ? posterMatch[1] : null; const synopsisMatch = html.match(/class=["'][^"']*entry-content[^"']*["'][^>]*>([\s\S]*?)<\/div>/i) || html.match(/class=["'][^"']*sinopsis[^"']*["'][^>]*>([\s\S]*?)<\/div>/i); const synopsis = synopsisMatch ? cleanText(synopsisMatch[1]) : null; const scoreMatch = html.match(/]*class=["'][^"']*kotakscore[^"']*["'][^>]*>([\s\S]*?)<\/span>/i); const score = scoreMatch ? cleanText(scoreMatch[1]) : null; const genres = [...html.matchAll(/]*href=["']https:\/\/s13\.nontonanimeid\.boats\/genres\/[^"']+["'][^>]*>([\s\S]*?)<\/a>/gi)] .map(m => cleanText(m[1])); const allEpMatches = [...html.matchAll(/]*href=["'](https:\/\/s13\.nontonanimeid\.boats\/[^"']*-episode-\d+\/)["'][^>]*>([\s\S]*?)<\/a>/gi)]; const seen = new Set(); const episodes = []; for (const ep of allEpMatches) { const epUrl = ep[1]; if (!seen.has(epUrl)) { seen.add(epUrl); const rawText = cleanText(ep[2]); const numMatch = epUrl.match(/-episode-(\d+)\//); episodes.push({ episodeNumber: numMatch ? Number(numMatch[1]) : null, title: rawText || (numMatch ? `Episode ${numMatch[1]}` : 'Episode'), url: epUrl }); } } episodes.sort((a, b) => (a.episodeNumber || 0) - (b.episodeNumber || 0)); return { Creator: CREATOR, Saluran: SALURAN, status: true, data: { title, url, poster, score, genres: [...new Set(genres)], synopsis, totalEpisodes: episodes.length, episodes } }; } /** * 4. Informasi episode & daftar server player video */ async function episode(urlOrSlug) { const url = urlOrSlug.startsWith('http') ? urlOrSlug : `${BASE_URL}/${urlOrSlug.replace(/^\//, '').replace(/\/$/, '')}/`; const html = await request(url); const titleMatch = html.match(/]*>([\s\S]*?)<\/h1>/i); const title = titleMatch ? cleanText(titleMatch[1]) : null; let ajaxConfig = null; const jsonMatch = html.match(/kotakajax\s*=\s*(\{.+?\})/); if (jsonMatch) { try { ajaxConfig = JSON.parse(jsonMatch[1]); } catch {} } else { const b64Matches = [...html.matchAll(/data:text\/javascript;base64,([A-Za-z0-9+/=]+)/g)]; for (const m of b64Matches) { const decoded = Buffer.from(m[1], 'base64').toString('utf8'); const jm = decoded.match(/var\s+kotakajax\s*=\s*(\{.+?\})/); if (jm) { try { ajaxConfig = JSON.parse(jm[1]); break; } catch {} } } } const serverTabs = []; const tabMatches = [...html.matchAll(/]*kotak_player_option[^>]*)>([\s\S]*?)<\/li>/gi)]; for (const t of tabMatches) { const attrs = t[1]; const label = cleanText(t[2]); const post = (attrs.match(/data-post=["']([^"']+)["']/) || [])[1]; const serverName = (attrs.match(/data-type=["']([^"']+)["']/) || [])[1]; const nume = (attrs.match(/data-nume=["']([^"']+)["']/) || [])[1]; if (serverName) { serverTabs.push({ serverName, label: label || serverName, post: post || null, nume: nume || null }); } } const prevMatch = html.match(/]*class=["'][^"']*prev[^"']*["'][^>]*href=["']([^"']+)["']/i); const nextMatch = html.match(/]*class=["'][^"']*next[^"']*["'][^>]*href=["']([^"']+)["']/i); return { Creator: CREATOR, Saluran: SALURAN, status: true, data: { title, url, ajaxEndpoint: ajaxConfig?.url || `${BASE_URL}/wp-admin/admin-ajax.php`, nonce: ajaxConfig?.nonce || null, servers: serverTabs, navigation: { previous: prevMatch ? prevMatch[1] : null, next: nextMatch ? nextMatch[1] : null } } }; } /** * 5. Jadwal Rilis Anime (/jadwal-rilis/) */ async function schedule() { const html = await request(`${BASE_URL}/jadwal-rilis/`); const dayKeys = ['senin', 'selasa', 'rabu', 'kamis', 'jumat', 'sabtu', 'minggu']; const days = []; for (let i = 0; i < dayKeys.length; i++) { const key = dayKeys[i]; const tag = `id='${key}'`; const idx = html.indexOf(tag); if (idx === -1) continue; let endIdx = -1; if (i + 1 < dayKeys.length) { endIdx = html.indexOf(`id='${dayKeys[i + 1]}'`, idx); } else { endIdx = html.indexOf('', idx); if (endIdx === -1) endIdx = html.indexOf('footer', idx); } const block = html.slice(idx, endIdx !== -1 ? endIdx : idx + 40000); const dayMatch = block.match(/data-day=['"]([^'"]+)['"]/i); const dateMatch = block.match(/data-date-text=['"]([^'"]+)['"]/i); const items = []; const cardMatches = [...block.matchAll(/([\s\S]*?)<\/a>/gi)]; for (const c of cardMatches) { const url = c[2]; const inner = c[4]; const titleMatch = inner.match(/]*class=['"][^'"]*as-anime-title[^'"]*['"][^>]*>([\s\S]*?)<\/h3>/i) || c[0].match(/data-title=['"]([^'"]+)['"]/i); const epMatch = inner.match(/class=['"][^'"]*jr-ep-text[^'"]*['"][^>]*>([\s\S]*?)<\/span>/i); const typeMatch = inner.match(/class=['"][^'"]*jr-type-badge[^'"]*['"][^>]*>([\s\S]*?)<\/span>/i); const timeMatch = inner.match(/class=['"][^'"]*jr-time-val[^'"]*['"][^>]*>([\s\S]*?)<\/span>/i); const scoreMatch = inner.match(/class=['"][^'"]*rating-text[^'"]*['"][^>]*>([\s\S]*?)<\/span>/i); const posterMatch = inner.match(/]*src=['"]([^'"]+)['"]/i); items.push({ title: titleMatch ? cleanText(titleMatch[1]) : null, url, episode: epMatch ? cleanText(epMatch[1]) : null, type: typeMatch ? cleanText(typeMatch[1]) : null, time: timeMatch ? cleanText(timeMatch[1]) : null, score: scoreMatch ? cleanText(scoreMatch[1]).replace(/⭐/g, '').trim() : null, poster: posterMatch ? posterMatch[1] : null }); } days.push({ key, day: dayMatch ? dayMatch[1] : key.toUpperCase(), date: dateMatch ? dateMatch[1] : null, count: items.length, items }); } return { Creator: CREATOR, Saluran: SALURAN, status: true, source: `${BASE_URL}/jadwal-rilis/`, totalDays: days.length, days }; } /** * CLI Runner */ async function main() { const args = process.argv.slice(2); if (!args.length || args.includes('-h') || args.includes('--help')) { console.log(` ==================================================================== NontonAnimeID All-in-One Scraper CLI Creator : ${CREATOR} Saluran : ${SALURAN} ==================================================================== Penggunaan: node index.js latest [page] -> Ambil anime rilis terbaru node index.js search -> Cari anime berdasarkan judul node index.js detail -> Detail anime dan daftar episode node index.js episode -> Detail episode dan server player node index.js schedule -> Jadwal rilis anime harian Contoh: node index.js latest node index.js search naruto node index.js detail diamond-no-ace-act-ii-second-season-part-2 node index.js episode diamond-no-ace-act-ii-second-season-part-2-episode-7 node index.js schedule `); return; } const command = args[0].toLowerCase(); if (command === 'latest' || command === 'terbaru') { const page = Number(args[1]) || 1; const res = await latest(page); console.log(JSON.stringify(res, null, 2)); } else if (command === 'search' || command === 'cari') { const query = args.slice(1).join(' ').trim(); const res = await search(query); console.log(JSON.stringify(res, null, 2)); } else if (command === 'detail') { const target = args[1]; if (!target) throw new Error('Slug atau URL anime diperlukan'); const res = await detail(target); console.log(JSON.stringify(res, null, 2)); } else if (command === 'episode' || command === 'ep') { const target = args[1]; if (!target) throw new Error('Slug atau URL episode diperlukan'); const res = await episode(target); console.log(JSON.stringify(res, null, 2)); } else if (command === 'schedule' || command === 'jadwal') { const res = await schedule(); console.log(JSON.stringify(res, null, 2)); } else { const query = args.join(' ').trim(); const res = await search(query); console.log(JSON.stringify(res, null, 2)); } } const isDirectRun = typeof process !== 'undefined' && process.argv[1] && (process.argv[1].endsWith('index.js') || process.argv[1].endsWith('index.mjs') || process.argv[1].includes('s13.nontonanimeid.boats')); if (isDirectRun) { main().catch(err => { console.error(JSON.stringify({ Creator: CREATOR, Saluran: SALURAN, status: false, error: err.message }, null, 2)); process.exit(1); }); } export { latest, search, detail, episode, schedule }; export default { latest, search, detail, episode, schedule };