scraperjavascript174112
Komikcast Scraper (Inertia.js State Bypass)
Scraper komik dan manga untuk komikcast.info. Mendukung pencarian komik, manga terbaru & terpopuler, detail komik beserta daftar seluruh chapter, dan image reader chapter resolusi tinggi dari CDN R2.
Vamz Spectre21 Okt 2026372 baris kode
Jalankan via Terminal / CLI:
# 1. Download file script
curl -sL "https://code.vamxapi.my.id/snippet/raw/komikcast-scraper" -o komikcast-scraper.js
# 2. Jalankan script
node komikcast-scraper.js
komikcast-scraper.js(372 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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
/**
* Komikcast Scraper (Inertia.js SSR State Bypass)
* Target: https://komikcast.info
* Author: Vamz Spectre (VamxAPI)
*
* Features:
* - Manga Search with pagination, status, and latest chapter info
* - Latest Manga Updates & Popular Manga
* - Manga Detail (synopsis, author, artist, genres, full chapters list)
* - Chapter Reader (high-res direct R2 CDN image list, prev/next chapter navigation)
*
* Usage:
* curl -sL "https://code.vamxapi.my.id/snippet/raw/komikcast-scraper" -o komikcast-scraper.js
* node komikcast-scraper.js "solo"
* node komikcast-scraper.js "solo-swordmaster"
* node komikcast-scraper.js "solo-swordmaster" 23
* node komikcast-scraper.js "https://komikcast.info/manga/solo-swordmaster/chapter/23"
*/
const https = require('https');
const http = require('http');
const { URL } = require('url');
class KomikcastScraper {
constructor(options = {}) {
this.baseUrl = options.baseUrl || 'https://komikcast.info';
this.timeout = options.timeout || 15000;
this.userAgent = options.userAgent || 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36';
}
/**
* Internal request to fetch and parse Inertia.js data-page props
*/
fetchProps(endpoint) {
return new Promise((resolve, reject) => {
const targetUrl = endpoint.startsWith('http') ? endpoint : `${this.baseUrl}${endpoint.startsWith('/') ? '' : '/'}${endpoint}`;
const client = targetUrl.startsWith('https') ? https : http;
const req = client.get(targetUrl, {
timeout: this.timeout,
headers: {
'User-Agent': this.userAgent,
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.9,id;q=0.8',
'Sec-Ch-Ua': '"Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"',
'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Platform': '"Windows"'
}
}, (res) => {
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
const redirectUrl = new URL(res.headers.location, targetUrl).toString();
return resolve(this.fetchProps(redirectUrl));
}
if (res.statusCode !== 200) {
return reject(new Error(`Gagal menghubungi Komikcast (HTTP ${res.statusCode})`));
}
let body = '';
res.on('data', (chunk) => body += chunk);
res.on('end', () => {
try {
const match = body.match(/data-page="([^"]+)"/);
if (!match) {
return reject(new Error('Gagal mengekstrak data-page dari respons Komikcast.'));
}
const decoded = match[1]
.replace(/"/g, '"')
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/'/g, "'");
const pageJson = JSON.parse(decoded);
resolve(pageJson.props || {});
} catch (err) {
reject(new Error(`Gagal mem-parsing data Komikcast: ${err.message}`));
}
});
});
req.on('error', reject);
req.on('timeout', () => {
req.destroy();
reject(new Error('Request timeout saat menghubungi Komikcast.'));
});
});
}
/**
* Search manga by keyword
*/
async search(query, page = 1) {
if (!query) throw new Error('Query pencarian manga tidak boleh kosong.');
const props = await this.fetchProps(`/manga?search=${encodeURIComponent(query)}&page=${page}`);
const mangas = props.mangas || {};
const items = (mangas.data || []).map((item) => ({
id: item.id,
title: item.title,
slug: item.slug,
url: `${this.baseUrl}/manga/${item.slug}`,
poster: item.poster,
type: item.type,
status: item.status,
rating: item.rating,
release_year: item.release_year,
author: item.author,
artist: item.artist,
genres: (item.genres || []).map((g) => g.name),
last_chapter: item.last_chapter ? {
id: item.last_chapter.id,
title: item.last_chapter.title,
chapter_number: item.last_chapter.chapter_number,
url: `${this.baseUrl}/manga/${item.slug}/chapter/${item.last_chapter.chapter_number}`
} : null
}));
return {
status: true,
creator: 'Vamz Spectre',
data: {
query,
current_page: mangas.current_page || 1,
last_page: mangas.last_page || 1,
total_results: mangas.total || items.length,
results: items
}
};
}
/**
* Get latest updated mangas
*/
async latest(page = 1) {
const props = await this.fetchProps(`/manga?sort=latest&page=${page}`);
const mangas = props.mangas || {};
const items = (mangas.data || []).map((item) => ({
id: item.id,
title: item.title,
slug: item.slug,
url: `${this.baseUrl}/manga/${item.slug}`,
poster: item.poster,
type: item.type,
status: item.status,
rating: item.rating,
genres: (item.genres || []).map((g) => g.name),
last_chapter: item.last_chapter ? {
id: item.last_chapter.id,
title: item.last_chapter.title,
chapter_number: item.last_chapter.chapter_number,
url: `${this.baseUrl}/manga/${item.slug}/chapter/${item.last_chapter.chapter_number}`
} : null
}));
return {
status: true,
creator: 'Vamz Spectre',
data: {
page: mangas.current_page || 1,
last_page: mangas.last_page || 1,
total: mangas.total || items.length,
results: items
}
};
}
/**
* Get popular mangas
*/
async popular(page = 1) {
const props = await this.fetchProps(`/manga?sort=popular&page=${page}`);
const mangas = props.mangas || {};
const items = (mangas.data || []).map((item) => ({
id: item.id,
title: item.title,
slug: item.slug,
url: `${this.baseUrl}/manga/${item.slug}`,
poster: item.poster,
type: item.type,
status: item.status,
rating: item.rating,
genres: (item.genres || []).map((g) => g.name),
last_chapter: item.last_chapter ? {
id: item.last_chapter.id,
title: item.last_chapter.title,
chapter_number: item.last_chapter.chapter_number,
url: `${this.baseUrl}/manga/${item.slug}/chapter/${item.last_chapter.chapter_number}`
} : null
}));
return {
status: true,
creator: 'Vamz Spectre',
data: {
page: mangas.current_page || 1,
last_page: mangas.last_page || 1,
total: mangas.total || items.length,
results: items
}
};
}
/**
* Get full manga details & chapter list
*/
async detail(slugOrUrl) {
let slug = slugOrUrl;
if (slugOrUrl.includes('/manga/')) {
const match = slugOrUrl.match(/\/manga\/([^/?#]+)/);
if (match) slug = match[1];
}
slug = slug.trim().replace(/^\/+|\/+$/g, '');
const props = await this.fetchProps(`/manga/${slug}`);
const m = props.manga;
if (!m) throw new Error(`Manga dengan slug "${slug}" tidak ditemukan.`);
const chapters = (m.chapters || []).map((c) => ({
id: c.id,
title: c.title,
slug: c.slug,
chapter_number: c.chapter_number,
url: `${this.baseUrl}/manga/${m.slug}/chapter/${c.chapter_number}`,
views_count: c.views_count,
created_at: c.created_at
}));
return {
status: true,
creator: 'Vamz Spectre',
data: {
id: m.id,
title: m.title,
slug: m.slug,
url: `${this.baseUrl}/manga/${m.slug}`,
poster: m.poster,
synopsis: m.synopsis,
type: m.type,
status: m.status,
author: m.author,
artist: m.artist,
rating: m.rating,
release_year: m.release_year,
views_count: m.views_count,
genres: (m.genres || []).map((g) => ({
name: g.name,
slug: g.slug,
icon: g.icon
})),
total_chapters: chapters.length,
first_chapter: props.firstChapter ? {
chapter_number: props.firstChapter.chapter_number,
url: `${this.baseUrl}/manga/${m.slug}/chapter/${props.firstChapter.chapter_number}`
} : null,
chapters
}
};
}
/**
* Get chapter reading pages / images
*/
async chapter(slugOrUrl, chapterNumber = null) {
let targetPath = '';
if (slugOrUrl.startsWith('http')) {
const urlObj = new URL(slugOrUrl);
targetPath = urlObj.pathname;
} else if (chapterNumber !== null && chapterNumber !== undefined) {
targetPath = `/manga/${slugOrUrl}/chapter/${chapterNumber}`;
} else if (slugOrUrl.includes('/chapter/')) {
targetPath = slugOrUrl;
} else {
throw new Error('Format pemanggilan chapter tidak valid. Gunakan (slug, chapterNumber) atau URL chapter.');
}
const props = await this.fetchProps(targetPath);
const ch = props.chapter;
const m = props.manga;
if (!ch) throw new Error('Data chapter tidak ditemukan.');
const images = (ch.images || []).map((img, idx) => ({
order: img.order !== undefined ? img.order : idx,
url: img.r2_url || img.image_path,
bytes: img.r2_bytes || null
}));
return {
status: true,
creator: 'Vamz Spectre',
data: {
chapter_id: ch.id,
manga_title: m?.title || null,
manga_slug: m?.slug || null,
chapter_title: ch.title,
chapter_number: ch.chapter_number,
total_images: images.length,
navigation: {
prev: props.prev ? `${this.baseUrl}/manga/${m?.slug}/chapter/${props.prev.chapter_number}` : null,
next: props.next ? `${this.baseUrl}/manga/${m?.slug}/chapter/${props.next.chapter_number}` : null
},
images
}
};
}
}
// CLI Runner
if (require.main === module) {
const arg1 = process.argv[2];
const arg2 = process.argv[3];
if (!arg1) {
console.log(JSON.stringify({
status: false,
message: 'Parameter query/slug/URL komikcast wajib disertakan.',
usage: [
'node komikcast-scraper.js "solo"',
'node komikcast-scraper.js "latest"',
'node komikcast-scraper.js "popular"',
'node komikcast-scraper.js "solo-swordmaster"',
'node komikcast-scraper.js "solo-swordmaster" 23',
'node komikcast-scraper.js "https://komikcast.info/manga/solo-swordmaster/chapter/23"'
]
}, null, 2));
process.exit(1);
}
const scraper = new KomikcastScraper();
(async () => {
if (arg1 === 'latest') {
return await scraper.latest(Number(arg2) || 1);
}
if (arg1 === 'popular') {
return await scraper.popular(Number(arg2) || 1);
}
if (arg2) {
return await scraper.chapter(arg1, arg2);
}
if (arg1.startsWith('http')) {
if (arg1.includes('/chapter/')) {
return await scraper.chapter(arg1);
}
return await scraper.detail(arg1);
}
// If it looks like a clean slug without spaces, fetch detail, otherwise search
if (/^[a-z0-9-]+$/i.test(arg1) && !arg1.includes(' ')) {
try {
return await scraper.detail(arg1);
} catch (_) {
return await scraper.search(arg1);
}
}
return await scraper.search(arg1);
})()
.then((res) => {
console.log(JSON.stringify(res, null, 2));
})
.catch((err) => {
console.log(JSON.stringify({
status: false,
error: err.message
}, null, 2));
process.exit(1);
});
}
module.exports = KomikcastScraper;