anime movie
No comments yet. Be the first to comment!
1/**
2 * CINESUBZ (ZETAFLIX) ENGINE
3 * Base : https://cinesubz.lk
4 * Author : Gienetic
5 * Fitur : Auto-Bypass Nonce WP, Search Extractor, Direct MP4 Resolver
6 */
7
8const axios = require('axios');
9const readline = require('readline');
10const fs = require('fs');
11
12const BASE_URL = 'https://cinesubz.net';
13
14const getHeaders = (isAjax = false) => {
15 const headers = {
16 'user-agent': 'Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Mobile Safari/537.36',
17 'accept': 'application/json, text/javascript, */*; q=0.01',
18 'referer': `${BASE_URL}/`
19 };
20 if (isAjax) {
21 headers['x-requested-with'] = 'XMLHttpRequest';
22 headers['content-type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
23 headers['origin'] = BASE_URL;
24 }
25 return headers;
26};
27
28// Mengambil security token (nonce) dari homepage WordPress
29const fetchNonce = async () => {
30 try {
31 const res = await axios.get(BASE_URL, {
32 headers: getHeaders(),
33 timeout: 10000
34 });
35 const match = res.data.match(/"nonce":"([a-z0-9]+)"/);
36 return match ? match[1] : null;
37 } catch (err) {
38 return null;
39 }
40};
41
42// Mencari film/series berdasarkan keyword
43const searchMovie = async (keyword) => {
44 const nonce = await fetchNonce();
45 if (!nonce) throw new Error("Gagal mendapatkan security nonce.");
46
47 const targetUrl = `${BASE_URL}/wp-json/zetaflix/search/?keyword=${encodeURIComponent(keyword)}&nonce=${nonce}`;
48
49 try {
50 const res = await axios.get(targetUrl, {
51 headers: getHeaders(),
52 timeout: 10000
53 });
54 const rawData = res.data;
55
56 if (!rawData || typeof rawData !== 'object' || Object.keys(rawData).length === 0) return [];
57
58 // Parsing JSON Object (ID sebagai key) menjadi JSON Array standar
59 return Object.keys(rawData).map(postId => ({
60 id: postId,
61 title: rawData[postId].title,
62 url: rawData[postId].url,
63 img: rawData[postId].img,
64 genres: rawData[postId].extra?.genres || '',
65 year: rawData[postId].extra?.date || '',
66 imdb: rawData[postId].extra?.imdb || '',
67 runtime: rawData[postId].extra?.runtime || ''
68 }));
69 } catch (err) {
70 throw err;
71 }
72};
73
74const extractVideoLink = async (postId, serverNum = 1, type = 'mv') => {
75 const targetUrl = `${BASE_URL}/wp-admin/admin-ajax.php`;
76
77 // Payload harus URL-Encoded untuk admin-ajax.php
78 const payload = new URLSearchParams({
79 action: 'zeta_player_ajax',
80 post: postId.toString(),
81 nume: serverNum.toString(),
82 type: type
83 });
84
85 try {
86 const res = await axios.post(targetUrl, payload.toString(), {
87 headers: getHeaders(true),
88 timeout: 15000
89 });
90 const data = res.data;
91
92 if (data && data.embed_url) {
93 try {
94 // Mengambil parameter 'source' dari URL embed JWPlayer
95 const urlObj = new URL(data.embed_url);
96 const directMp4 = urlObj.searchParams.get('source');
97
98 return {
99 success: true,
100 type: data.type,
101 url: directMp4 || data.embed_url, // Fallback jika parameter source tidak ada
102 is_direct: !!directMp4
103 };
104 } catch (e) {
105 return {
106 success: true,
107 type: 'iframe',
108 url: data.embed_url,
109 is_direct: false
110 };
111 }
112 }
113 return {
114 success: false,
115 error: 'Server kosong'
116 };
117 } catch (err) {
118 return {
119 success: false,
120 error: err.message
121 };
122 }
123};
124
125module.exports = {
126 fetchNonce,
127 searchMovie,
128 extractVideoLink
129};
130
131
132// ==========================================
133// CLI ENGINE
134// ==========================================
135
136if (require.main === module) {
137 const rl = readline.createInterface({
138 input: process.stdin,
139 output: process.stdout
140 });
141 const ask = (q) => new Promise((resolve) => rl.question(`? ${q}`, resolve));
142
143 const saveAndPrintJSON = (filename, data) => {
144 const jsonString = JSON.stringify(data, null, 2);
145 console.log(`\n=== OUTPUT JSON ===\n${jsonString}\n===================`);
146 try {
147 fs.writeFileSync(filename, jsonString);
148 console.log(`[+] File tersimpan: ${filename}`);
149 } catch (e) {
150 console.log(`[-] Gagal menyimpan file: ${e.message}`);
151 }
152 };
153
154 const handleSearch = async () => {
155 const kw = await ask('Masukkan Kata Kunci: ');
156 if (!kw.trim()) return;
157
158 process.stdout.write(`\n[~] Mem-bypass keamanan & mencari "${kw}"... `);
159
160 try {
161 const data = await searchMovie(kw);
162 if (data.length === 0) return console.log('KOSONG\n[-] Tidak ada hasil.');
163
164 console.log(`OK (${data.length} hasil)`);
165
166 // Tampilkan list singkat beserta ID
167 console.log('\n--- Hasil Pencarian ---');
168 data.forEach((item, index) => {
169 console.log(`[${index + 1}] ID: ${item.id} | ${item.title}`);
170 });
171
172 saveAndPrintJSON(`cinesubz_search_${kw.replace(/\s/g, '_').toLowerCase()}.json`, data);
173
174 } catch (error) {
175 console.log(`GAGAL\n[-] Error: ${error.message}`);
176 }
177 };
178
179 const handleExtract = async () => {
180 console.log('\n--- Ekstraksi Link Video ---');
181 const postId = await ask('Masukkan Post ID (Dapatkan dari menu Search): ');
182 if (!postId.trim()) return;
183
184 const type = await ask('Tipe Video (mv = Movie, tv = TV Show) [default: mv]: ');
185 const vType = type.trim().toLowerCase() === 'tv' ? 'tv' : 'mv';
186
187 console.log(`\n[*] Memindai Server 1 hingga 3...`);
188 let extractedLinks = [];
189
190 for (let i = 1; i <= 3; i++) {
191 process.stdout.write(`[~] Mengecek Server ${i}... `);
192 const result = await extractVideoLink(postId, i, vType);
193
194 if (result.success) {
195 console.log(`OK`);
196 extractedLinks.push({
197 server: i,
198 type: result.type,
199 is_direct_mp4: result.is_direct,
200 link: result.url
201 });
202 } else {
203 console.log(`KOSONG / GAGAL`);
204 }
205 }
206
207 if (extractedLinks.length > 0) {
208 saveAndPrintJSON(`cinesubz_video_${postId}.json`, extractedLinks);
209 } else {
210 console.log('\n[-] Tidak ada link video yang berhasil diekstrak.');
211 }
212 };
213
214 const runCLI = async () => {
215 console.clear();
216 console.log("===================================");
217 console.log(" CINESUBZ ENGINE CLI ");
218 console.log("===================================");
219
220 while (true) {
221 console.log('\n[ MAIN DASHBOARD ]');
222 console.log('1. Cari Film/Series (Mendapatkan Post ID)');
223 console.log('2. Ekstrak Link Video (Berdasarkan Post ID)');
224 console.log('0. Keluar');
225
226 const menu = await ask('\nPilihan: ');
227
228 switch (menu.trim()) {
229 case '1':
230 await handleSearch();
231 break;
232 case '2':
233 await handleExtract();
234 break;
235 case '0':
236 console.log('\n[!] Terminated.');
237 rl.close();
238 return;
239 default:
240 console.log('[-] Pilihan tidak valid.');
241 }
242 }
243 };
244
245 runCLI();
246}