scraperjavascript3414
NetShort Scraper & Direct Video Stream Extractor
Scraper drama pendek NetShort (netshort.com) lengkap dengan pencarian kata kunci, katalog beranda, list episode, dan ekstraksi direct link video MP4 CDN (hybrid RSA-2048 & AES-256-ECB).
Vamz Spectre12 Okt 2026284 baris kode
Jalankan via Terminal / CLI:
# 1. Download file script
curl -sL "https://code.vamxapi.my.id/snippet/raw/netshort-scraper" -o netshort-scraper.js
# 2. Jalankan script
node netshort-scraper.js
Dependencies npm yang Dibutuhkan:
npm install crypto (built-in), https (built-in)Panduan Penggunaan:
Jalankan langsung dengan Node.js v18+: node netshort.js tanpa perlu install dependency external.
netshort-scraper.js(284 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
/**
* ========================================================
* Name: NetShort Scraper & Direct Video Stream Extractor
*
* Cara Download:
* curl -sL "https://code.vamxapi.my.id/snippet/raw/netshort-scraper" -o netshort-scraper.js
*
* Cara Eksekusi:
* node netshort-scraper.js "Ceo"
*
* Author: Vamz Spectre
* Source: https://vamxapi.my.id
* ========================================================
*/
const crypto = require("crypto");
const https = require("https");
// Leaked Frontend RSA Public & Private Keys from NetShort Web Client Bundle
const RSA_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2poXMstZ8NCWE7915MXz
DWC5/t+oB2waGfskPqSZwLqxd4ZBR0H1cb1tAZRZcV7P+LmOd6SYNxhnELaWuKTD
+D3xkz8Tt1L5j/ynGqVt1MDbiQIEzXQKUkNDSH6T0A+Xzo/67/8QOQXlVJfW06res
baeNvibfx6Qc78j96bCIPlxPrtieilVTBHUFOXjirxK/ki/mO8P2smRbpt73fsQW
dGmTGMfYGvfPApGyxbxLkL/qrBjU25XpM8a0MBqzFWUAchHmqSBJ6Mbfam1SSgf3
b2U28s67nOW+JiOrhd6iVLcsLFxXA54HX+Zbej3AbOB6jKaEmp/bz1amneE1NYXw
wIDAQAB
-----END PUBLIC KEY-----`;
const RSA_PRIVATE_KEY = `-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCK0Tl1pd7bjTRU
93bWoHW1hLCDj2+9bg1MgY8j5C7xXaw6bJfToXhWbH1fXNbnFFVqxyYNErcuOUwJ
ZxyDgcxUXM4yWnRseb2GF97GOicAQ2keDzVYmwky4lrSRwvcXutJRLPUCRQNfc6u
pfk2G5TKh6/CcP4TV1eXTF7+vdEw2SHxAOITKbSfcaZXr/hVs6a1aRHsBF+7RG99
ebwZIP6/AgIyqX9RbDVN6ixi1v2G3/bwAULHLSqGdSaqij/ca17fbFGITaeCeEaZ
6d/P4ZuOK+PEPdbPQt6SbY4lZaYwRvdrpH73kigPITgDzIDONFybJ1m7wRKlq1wx
WHwbimptAgMBAAECggEAPz3cYJXFtt5YphDrahJGLgEabYVOUc2ub1li/eX54Opd
CWzpqneYnD7myyg/m5zu4SuD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hEhETwVIUtcBzsK25ju9LqL89bC+W0uS7BPvk6Tcws/tXHCkQCTgb9j
VXceZ2ox+6axvlW/5WgHt5Q=
-----END PRIVATE KEY-----`;
/**
* Helper: Request API NetShort dengan Handshake AES-256-ECB & RSA-2048
*/
function callNetshortApi(endpoint, payload, token = null) {
return new Promise((resolve, reject) => {
// 1. Generate AES Key 32 bytes
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
let aesKey = "";
for (let i = 0; i < 32; i++) aesKey += chars.charAt(Math.floor(Math.random() * chars.length));
const aesKeyBase64 = Buffer.from(aesKey, "utf8").toString("base64");
// 2. Enkripsi AES key dengan RSA Public Key
const encryptedKey = crypto.publicEncrypt({
key: RSA_PUBLIC_KEY,
padding: crypto.constants.RSA_PKCS1_PADDING
}, Buffer.from(aesKeyBase64, "utf8")).toString("base64");
// 3. Enkripsi Payload dengan AES-256-ECB
const cipher = crypto.createCipheriv("aes-256-ecb", Buffer.from(aesKey, "utf8"), null);
const bodyStr = JSON.stringify(payload);
const encryptedPayload = Buffer.concat([cipher.update(bodyStr, "utf8"), cipher.final()]).toString("base64");
// 4. Headers (dengan Authorization jika token disertakan)
const headers = {
"Content-Type": "application/json;charset=utf-8",
"Content-Language": "en",
"OS": "4",
"canary": "v1",
"version": "1.2.0",
"encrypt-key": encryptedKey,
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
};
if (token) {
headers["Authorization"] = `Bearer ${token}`;
}
// 5. Kirim request HTTP
const req = https.request({
hostname: "netshort.com",
path: "/prod-web-api" + endpoint,
method: "POST",
headers
}, (res) => {
let data = "";
res.on("data", c => data += c);
res.on("end", () => {
try {
const respEncKey = res.headers["encrypt-key"] || res.headers["Encrypt-Key"];
if (!respEncKey) {
try { return resolve(JSON.parse(data)); } catch { return resolve({ raw: data }); }
}
// Dekripsi AES Key respons dengan RSA Private Key
const decryptedKey = crypto.privateDecrypt({
key: RSA_PRIVATE_KEY,
padding: crypto.constants.RSA_PKCS1_PADDING
}, Buffer.from(respEncKey, "base64"));
const respAesKey = Buffer.from(decryptedKey.toString("utf8"), "base64").toString("utf8");
// Dekripsi Body respons dengan AES-256-ECB
const decipher = crypto.createDecipheriv("aes-256-ecb", Buffer.from(respAesKey, "utf8"), null);
const decryptedBody = Buffer.concat([decipher.update(Buffer.from(data, "base64")), decipher.final()]).toString("utf8");
resolve(JSON.parse(decryptedBody));
} catch (e) {
reject(e);
}
});
});
req.on("error", reject);
req.write(encryptedPayload);
req.end();
});
}
function fetchHtml(urlStr) {
return new Promise((resolve, reject) => {
const url = new URL(urlStr);
const options = {
hostname: url.hostname,
path: url.pathname + url.search,
headers: {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
}
};
https.get(options, (res) => {
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
let loc = res.headers.location;
if (loc.startsWith("/")) loc = "https://netshort.com" + loc;
return fetchHtml(loc).then(resolve).catch(reject);
}
let data = "";
res.on("data", c => data += c);
res.on("end", () => resolve(data));
}).on("error", reject);
});
}
/**
* 1. SEARCH: Cari Drama Berdasarkan Kata Kunci
*/
async function searchDrama(keyword, page = 1, pageSize = 10) {
const res = await callNetshortApi("/web/short_play/search/keyword/seo", {
pageQuery: { pageNum: page, pageSize: pageSize },
queryKeyword: keyword
});
if (res.code === 200 && res.data) {
const list = (res.data.list || []).map(item => ({
shortPlayId: item.shortPlayId,
title: item.shortPlayNameNoHL || item.shortPlayName.replace(/<[^>]+>/g, ""),
cover: item.shortPlayCover,
synopsis: item.shotIntroduce,
genres: item.labelNames ? item.labelNames.split(",") : [],
likes: item.likeNums,
chases: item.chaseNums,
url: `https://netshort.com${item.shortPlayNameUrl || "/episode/" + item.shortPlayId}`
}));
return {
status: true,
totalHits: res.data.totalHits,
page,
results: list
};
}
return { status: false, message: res.msg || "Pencarian gagal.", results: [] };
}
/**
* 2. KATALOG BERANDA: Ekstraksi Rekomendasi Drama Terpopuler
*/
async function getDramaList() {
const html = await fetchHtml("https://netshort.com/");
const items = [];
const regex = /\{\\"shortPlayLibraryId\\":\"[^"]+\\",\\"shortPlayId\\":\\"(\d+)\\",\\"shortPlayName\\":\\"([^"]+)\\"(?:.*?)\\"shortPlayCover\\":\\"([^"]+)\\"(?:.*?)\\"totalEpisode\\":(\d+)/g;
let m;
const seen = new Set();
while ((m = regex.exec(html)) !== null) {
if (!seen.has(m[1])) {
seen.add(m[1]);
items.push({
shortPlayId: m[1],
title: m[2],
cover: m[3],
totalEpisodes: parseInt(m[4], 10),
detailUrl: `https://netshort.com/full-episodes/drama-${m[1]}`
});
}
}
return { status: true, total: items.length, dramas: items };
}
/**
* 3. DETAIL EPISODE: Ekstraksi Daftar Episode Drama
*/
async function getDramaEpisodes(dramaSlugOrId) {
const url = `https://netshort.com/full-episodes/${dramaSlugOrId}`;
const html = await fetchHtml(url);
const epRegex = /\{\\"episodeId\\":\\"(\d+)\\",\\"episodeNo\\":(\d+),\\"episodeCover\\":\\"([^"]+)\\"/g;
const episodes = [];
let m;
while ((m = epRegex.exec(html)) !== null) {
episodes.push({
episodeId: m[1],
episodeNo: parseInt(m[2], 10),
episodeCover: m[3]
});
}
return { status: true, totalEpisodes: episodes.length, episodes };
}
/**
* 4. STREAMING VIDEO: Ekstraksi Direct MP4 Video URL (Cloudflare CDN)
* @param {string|number} shortPlayId ID Drama
* @param {number} episodeNo Nomor Episode
* @param {string|null} token Opsional: Token akun user jika ingin stream episode premium/VIP
*/
async function getEpisodeStream(shortPlayId, episodeNo = 1, token = null) {
const res = await callNetshortApi("/web/v4/short_play/episode_info", {
shortPlayId: String(shortPlayId),
episodeNo: Number(episodeNo)
}, token);
if (res.code === 200 && res.data) {
return {
status: true,
episodeId: res.data.episodeId,
episodeNo: res.data.episodeNo,
videoUrl: res.data.playVoucher || null,
isLocked: Boolean(res.data.isLock),
durationSeconds: parseFloat(res.data.duration || "0"),
coinPrice: res.data.episodeGoldCoinPrice || 0,
cover: res.data.episodeCover
};
}
return { status: false, message: res.msg || "Gagal mengambil stream video." };
}
// Module Exports
if (typeof module !== "undefined" && module.exports) {
module.exports = { searchDrama, getDramaList, getDramaEpisodes, getEpisodeStream };
}
/**
* CLI Runner:
* Langsung eksekusi jika dijalankan via terminal: node netshort-scraper.js "judul"
*/
const argDrama = process.argv[2];
if (argDrama) {
(async () => {
try {
if (/^\d+$/.test(argDrama)) {
const res = await getDramaEpisodes(argDrama);
console.log(JSON.stringify(res, null, 2));
} else {
const res = await searchDrama(argDrama);
console.log(JSON.stringify(res, null, 2));
}
} catch (err) {
console.error(JSON.stringify({ success: false, error: err.message }, null, 2));
process.exit(1);
}
})();
} else if (process.argv[1] && process.argv.length <= 2) {
console.log("Usage: node netshort-scraper.js \"<judul_drama>\"");
}