scraperjavascript101
OppaDrama K-Drama Scraper & Video Stream Extractor (Full Feature)
Full Scraper Drama Korea OppaDrama (oppadrama.io): Latest Update, Filter Series (Ongoing/Completed/Country), Search, Detail Series, Direct Stream Embed & Download.
Vamz Spectre11 Okt 2026337 baris kode
Jalankan via Terminal / CLI:
# 1. Download file script
curl -sL "https://code.vamxapi.my.id/snippet/raw/oppadrama-scraper" -o oppadrama-scraper.js
# 2. Jalankan script
node oppadrama-scraper.js
oppadrama-scraper.js(337 lines)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
/**
* OppaDrama K-Drama Scraper & Video Stream Extractor (Dual CJS/ESM Support)
* Author: Vamz Spectre / VamxAPI
* Website: https://vamxapi.my.id
* Channel: https://whatsapp.com/channel/0029Vb8n36OGE56uvRAq4y3y
*/
const BASE_URL = "https://oppadrama.io";
const HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7",
};
/**
* 1. Get Latest Episode Releases (Update Terbaru di Homepage)
* @param {number} page
*/
async function getLatestUpdates(page = 1) {
const url = page > 1 ? `${BASE_URL}/page/${page}/` : `${BASE_URL}/`;
const res = await fetch(url, { headers: HEADERS, signal: AbortSignal.timeout(15000) });
if (!res.ok) throw new Error(`HTTP Error ${res.status}`);
const html = await res.text();
const results = [];
const cards = html.match(/<div class="bsx">[\s\S]*?<\/div>\s*<\/div>/gi) || [];
for (const card of cards) {
const title = card.match(/title="([^"]+)"/i)?.[1]?.trim();
const link = card.match(/href="([^"]+)"/i)?.[1]?.trim();
const poster = card.match(/src="([^"]+)"/i)?.[1]?.trim() || card.match(/data-src="([^"]+)"/i)?.[1]?.trim();
const type = card.match(/class="typez ([^"]+)"/i)?.[1]?.trim() || "Episode";
const status = card.match(/class="bt [^"]*">([^<]+)<\/span>/i)?.[1]?.trim();
const ep = card.match(/class="epx">([^<]+)<\/span>/i)?.[1]?.trim();
if (title && link) {
results.push({
title,
url: link,
poster: poster || null,
type,
status: status || null,
episode_label: ep || null,
});
}
}
return {
status: true,
page: Number(page),
total: results.length,
results,
};
}
/**
* 2. Get Drama by Category / Country / Status
* @param {object} filter { status: 'Ongoing'|'Completed', country: 'south-korea'|'china'|'japan'|'thailand', page: 1 }
*/
async function getDramaList(filter = {}) {
const { status = "", country = "", page = 1 } = filter;
const params = new URLSearchParams();
if (status) params.append("status", status);
if (country) params.append("country[]", country);
params.append("type", "Drama");
params.append("order", "update");
if (page > 1) params.append("page", page);
const url = `${BASE_URL}/series/?${params.toString()}`;
const res = await fetch(url, { headers: HEADERS, signal: AbortSignal.timeout(15000) });
if (!res.ok) throw new Error(`HTTP Error ${res.status}`);
const html = await res.text();
const results = [];
const cards = html.match(/<div class="bsx">[\s\S]*?<\/div>\s*<\/div>/gi) || [];
for (const card of cards) {
const title = card.match(/title="([^"]+)"/i)?.[1]?.trim();
const link = card.match(/href="([^"]+)"/i)?.[1]?.trim();
const poster = card.match(/src="([^"]+)"/i)?.[1]?.trim() || card.match(/data-src="([^"]+)"/i)?.[1]?.trim();
const type = card.match(/class="typez ([^"]+)"/i)?.[1]?.trim() || "Drama";
const statusLabel = card.match(/class="bt [^"]*">([^<]+)<\/span>/i)?.[1]?.trim();
if (title && link) {
results.push({
title,
url: link,
poster: poster || null,
type,
status: statusLabel || null,
});
}
}
return {
status: true,
filter: { status, country, page: Number(page) },
total: results.length,
results,
};
}
/**
* 3. Search Drama Korea by Keyword
* @param {string} query
*/
async function searchDrama(query) {
if (!query || !query.trim()) throw new Error("Kata kunci pencarian tidak boleh kosong");
const url = `${BASE_URL}/?s=${encodeURIComponent(query.trim())}`;
const res = await fetch(url, { headers: HEADERS, signal: AbortSignal.timeout(15000) });
if (!res.ok) throw new Error(`HTTP Error ${res.status}`);
const html = await res.text();
const results = [];
const cards = html.match(/<div class="bsx">[\s\S]*?<\/div>\s*<\/div>/gi) || [];
for (const card of cards) {
const title = card.match(/title="([^"]+)"/i)?.[1]?.trim();
const link = card.match(/href="([^"]+)"/i)?.[1]?.trim();
const poster = card.match(/src="([^"]+)"/i)?.[1]?.trim() || card.match(/data-src="([^"]+)"/i)?.[1]?.trim();
const type = card.match(/class="typez ([^"]+)"/i)?.[1]?.trim() || "Drama";
const status = card.match(/class="bt [^"]*">([^<]+)<\/span>/i)?.[1]?.trim();
const ep = card.match(/class="epx">([^<]+)<\/span>/i)?.[1]?.trim();
if (title && link) {
results.push({
title,
url: link,
poster: poster || null,
type,
status: status || null,
episode_label: ep || null,
});
}
}
return {
status: true,
total: results.length,
results,
};
}
/**
* 4. Get Drama Detail & Full Episode List
* @param {string} seriesUrl (e.g. https://oppadrama.io/series/salon-de-nabi/)
*/
async function getDramaDetail(seriesUrl) {
if (!seriesUrl || !seriesUrl.trim()) throw new Error("URL Series wajib diisi");
const res = await fetch(seriesUrl, { headers: HEADERS, signal: AbortSignal.timeout(15000) });
if (!res.ok) throw new Error(`HTTP Error ${res.status}`);
const html = await res.text();
const title = html.match(/<h1[^>]*class=["']entry-title["'][^>]*>([\s\S]*?)<\/h1>/i)?.[1]?.trim();
const poster = html.match(/<div class="thumb"[^>]*>[\s\S]*?<img[^>]+src=["']([^"']+)["']/i)?.[1];
const synopsis = html.match(/<div class="entry-content entry-content-single"[^>]*>([\s\S]*?)<\/div>/i)?.[1]?.replace(/<[^>]+>/g, "").trim();
// Extract Metadata Info
const rating = html.match(/class="rating">[\s\S]*?<strong>([^<]+)<\/strong>/i)?.[1]?.trim();
const status = html.match(/<span><b>Status:<\/b>([\s\S]*?)<\/span>/i)?.[1]?.trim();
const network = html.match(/<span><b>Network:<\/b>([\s\S]*?)<\/span>/i)?.[1]?.trim();
const country = html.match(/<span><b>Country:<\/b>([\s\S]*?)<\/span>/i)?.[1]?.trim();
// Extract Episodes
const episodes = [];
const epMatches = html.match(/<li[^>]*data-index="[^"]*"[^>]*>[\s\S]*?<\/li>/gi) || [];
for (const epHtml of epMatches) {
const link = epHtml.match(/href=["']([^"']+)["']/i)?.[1]?.trim();
const epNum = epHtml.match(/<div class="epl-num">([^<]+)<\/div>/i)?.[1]?.trim();
const epTitle = epHtml.match(/<div class="epl-title">([^<]+)<\/div>/i)?.[1]?.trim();
const epDate = epHtml.match(/<div class="epl-date">([^<]+)<\/div>/i)?.[1]?.trim();
if (link) {
episodes.push({
episode: epNum || null,
title: epTitle || null,
release_date: epDate || null,
url: link,
});
}
}
return {
status: true,
title: title || "ā",
poster: poster || null,
rating: rating || null,
status: status || null,
network: network || null,
country: country || null,
synopsis: synopsis || null,
total_episodes: episodes.length,
episodes,
};
}
/**
* 5. Get Episode Streaming Stream & Download Links
* @param {string} episodeUrl (e.g. https://oppadrama.io/salon-de-nabi-episode-6/)
*/
async function getEpisodeStream(episodeUrl) {
if (!episodeUrl || !episodeUrl.trim()) throw new Error("URL Episode wajib diisi");
const res = await fetch(episodeUrl, { headers: HEADERS, signal: AbortSignal.timeout(15000) });
if (!res.ok) throw new Error(`HTTP Error ${res.status}`);
const html = await res.text();
const title = html.match(/<h1[^>]*class=["']entry-title["'][^>]*>([\s\S]*?)<\/h1>/i)?.[1]?.trim();
// Streaming Mirrors
const streams = [];
const select = html.match(/<select class="mirror"[\s\S]*?<\/select>/i)?.[0];
if (select) {
const options = select.match(/<option[^>]+value="([^"]+)"[^>]*>/gi) || [];
for (let opt of options) {
const val = opt.match(/value="([^"]+)"/i)?.[1];
if (val) {
try {
const decoded = Buffer.from(val, "base64").toString("utf-8");
const src = decoded.match(/src="([^"]+)"/i)?.[1];
if (src) streams.push({ type: "embed", player_url: src });
} catch {}
}
}
}
// Fallback direct iframe in content
if (!streams.length) {
const directIframe = html.match(/<iframe[^>]+src=["']([^"]+)"/i)?.[1];
if (directIframe) streams.push({ type: "embed", player_url: directIframe });
}
// Download Links
const downloads = [];
const dlLinks = html.match(/<a[^>]+href=["'](https?:\/\/[^"']+)["'][^>]*><div class="icol"><i class="fas fa-cloud-download-alt"><\/i>[\s\S]*?<\/a>/gi) || [];
for (const dl of dlLinks) {
const dlUrl = dl.match(/href=["']([^"]+)"/i)?.[1];
if (dlUrl) {
let host = "Server Download";
try { host = new URL(dlUrl).hostname; } catch {}
downloads.push({ host, url: dlUrl });
}
}
// Navigation Links
const prevEp = html.match(/<div class="nvs"><a[^>]+href=["']([^"']+)["'][^>]*rel="prev"/i)?.[1];
const nextEp = html.match(/<div class="nvs"><a[^>]+href=["']([^"']+)["'][^>]*rel="next"/i)?.[1];
const allEps = html.match(/<div class="nvs nvsc"><a[^>]+href=["']([^"']+)["']/i)?.[1];
return {
status: true,
title: title || "ā",
streams,
downloads,
navigation: {
prev_episode: prevEp || null,
next_episode: nextEp || null,
all_episodes: allEps || null,
},
};
}
// Universal Export (Support CJS & ESM)
if (typeof module !== "undefined" && module.exports) {
module.exports = {
getLatestUpdates,
getDramaList,
searchDrama,
getDramaDetail,
getEpisodeStream,
};
}
// Mode CLI Langsung
const isDirectCli = typeof require !== "undefined" && typeof module !== "undefined"
? require.main === module
: process.argv[1]?.endsWith("oppadrama-scraper.js");
if (isDirectCli) {
const args = process.argv.slice(2);
const action = args[0];
const param = args.slice(1).join(" ");
if (!action) {
console.log(`
=====================================================
OPPADRAMA K-DRAMA SCRAPER & STREAM EXTRACTOR
=====================================================
š CARA PENGGUNAAN LENGKAP:
1. Episode Rilis Terbaru (Homepage):
node oppadrama-scraper.js latest [page]
2. Daftar Drama Filter (Ongoing / Completed / Country):
node oppadrama-scraper.js list [status] [country]
3. Cari Drama Korea:
node oppadrama-scraper.js search <judul_drama>
4. Detail Drama & Daftar Episode:
node oppadrama-scraper.js detail <url_series>
5. Stream & Download Episode:
node oppadrama-scraper.js stream <url_episode>
=====================================================
`);
process.exit(1);
}
(async () => {
try {
console.log(`ā³ Memproses ${action}...`);
if (action === "latest") {
const res = await getLatestUpdates(args[1] || 1);
console.log(JSON.stringify(res, null, 2));
} else if (action === "list") {
const res = await getDramaList({ status: args[1] || "", country: args[2] || "" });
console.log(JSON.stringify(res, null, 2));
} else if (action === "search") {
const res = await searchDrama(param);
console.log(JSON.stringify(res, null, 2));
} else if (action === "detail") {
const res = await getDramaDetail(param);
console.log(JSON.stringify(res, null, 2));
} else if (action === "stream") {
const res = await getEpisodeStream(param);
console.log(JSON.stringify(res, null, 2));
} else {
console.log("ā Aksi tidak valid. Gunakan: latest | list | search | detail | stream");
}
} catch (err) {
console.error("ā Terjadi Kesalahan:", err.message);
}
})();
}