scraperjavascript236
Google Play Store - Full App Metadata, Reviews, Rating & Screenshots Scraper
Scraper real-time Google Play Store untuk mengambil metadata lengkap aplikasi Android (judul, deskripsi, developer info, email, alamat, no hp, rating breakdown/histogram, downloads count, price/IAP, version, icon, header image, screenshot resolusi tinggi, dan ulasan pengguna terbaru) tanpa dependensi eksternal.
Vamz Spectre18 Okt 2026249 baris kode
Jalankan via Terminal / CLI:
# 1. Download file script
curl -sL "https://code.vamxapi.my.id/snippet/raw/playstore-scraper" -o playstore-scraper.js
# 2. Jalankan script
node playstore-scraper.js
Dependencies npm yang Dibutuhkan:
npm install None (Native Node.js 18+ Fetch)Panduan Penggunaan:
Jalankan via CLI: node playstore-scraper.js "com.flow.mobile" atau gunakan sebagai modul import { scrapePlayStore }.playstore-scraper.js(249 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
/**
* Google Play Store - Full App Metadata, Reviews, Rating & Screenshots Scraper
*
* Download & Run CLI:
* curl -sL "https://code.vamxapi.my.id/snippet/raw/playstore-scraper" -o playstore-scraper.js
* node playstore-scraper.js "com.flow.mobile"
* node playstore-scraper.js "https://play.google.com/store/apps/details?id=com.flow.mobile"
*
* Author: Vamz Spectre / VamxAPI
*/
function decodeHtmlEntities(str) {
if (!str) return "";
return str
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, "\"")
.replace(/'/g, "'")
.replace(/ /g, " ");
}
function cleanHtml(html) {
if (!html) return "";
return decodeHtmlEntities(
html.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]+>/g, "").trim()
);
}
function formatNumber(num) {
if (!num) return "0";
if (num >= 1000000) return (num / 1000000).toFixed(1).replace(/\.0$/, "") + "M";
if (num >= 1000) return (num / 1000).toFixed(1).replace(/\.0$/, "") + "K";
return num.toString();
}
/**
* Scrape detail aplikasi Google Play Store secara lengkap & real-time
* @param {string} input - URL Play Store atau Package ID (contoh: com.flow.mobile)
* @param {Object} [options] - Opsi konfigurasi (hl: bahasa, gl: negara)
* @returns {Promise<Object>} Metadata aplikasi Google Play Store
*/
async function scrapePlayStore(input, options = {}) {
if (!input || typeof input !== "string" || !input.trim()) {
throw new Error("Parameter URL Google Play Store atau Package ID wajib disertakan.");
}
const raw = input.trim();
const pkgMatch =
raw.match(/[?&]id=([a-zA-Z0-9._]+)/) ||
raw.match(/details\/([a-zA-Z0-9._]+)/) ||
raw.match(/^([a-zA-Z0-9._]+)$/);
if (!pkgMatch) {
throw new Error("Format Package ID atau URL Google Play Store tidak valid. Contoh: com.flow.mobile");
}
const packageId = pkgMatch[1];
const hl = options.hl || "id";
const gl = options.gl || "ID";
const targetUrl = `https://play.google.com/store/apps/details?id=${encodeURIComponent(packageId)}&hl=${hl}&gl=${gl}`;
const res = await fetch(targetUrl, {
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-Language": `${hl}-${gl},${hl};q=0.9,en-US;q=0.8,en;q=0.7`,
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
}
});
if (!res.ok) {
if (res.status === 404) {
throw new Error(`Aplikasi dengan package ID "${packageId}" tidak ditemukan di Google Play Store.`);
}
throw new Error(`Google Play Store merespons status HTTP ${res.status}.`);
}
const html = await res.text();
// 1. Ekstrak Structured Data Schema (ld+json)
let ld = {};
const ldMatch = html.match(/<script type="application\/ld\+json"[^>]*>([\s\S]*?)<\/script>/i);
if (ldMatch) {
try {
ld = JSON.parse(ldMatch[1]);
} catch {}
}
// 2. Ekstrak Data Engine Internal Google Play (AF_initDataCallback)
const allCallbacks = [];
const cbRegex = /AF_initDataCallback\s*\(\s*(\{[\s\S]*?\})\s*\)\s*;/g;
for (const match of html.matchAll(cbRegex)) {
try {
const fn = new Function("return " + match[1]);
allCallbacks.push(fn());
} catch {}
}
// App detail callback (ds:5)
const detailCb = allCallbacks.find(c => c.data && Array.isArray(c.data) && c.data[1]?.[2]?.[77]?.[0] === packageId)
|| allCallbacks.find(c => c.key === "ds:5" && c.data?.[1]?.[2]);
const appInfo = detailCb?.data?.[1]?.[2] || null;
// Reviews callback (ds:10)
const reviewsCb = allCallbacks.find(c => c.key === "ds:10" && Array.isArray(c.data?.[0]));
const rawReviews = reviewsCb?.data?.[0] || [];
const reviews = rawReviews.slice(0, 10).map(r => ({
id: r[0],
user_name: r[1]?.[0] || "Pengguna Google Play",
user_avatar: r[1]?.[1]?.[3]?.[2] || null,
rating: r[2] || 0,
content: r[4] || "",
timestamp: r[5]?.[0] ? new Date(r[5][0] * 1000).toISOString() : null,
likes: r[6] || 0,
app_version: r[10] || null,
developer_reply: r[7] ? {
reply_text: r[7][1] || "",
timestamp: r[7][2]?.[0] ? new Date(r[7][2][0] * 1000).toISOString() : null
} : null
}));
const title = appInfo?.[0]?.[0] || ld.name || "Aplikasi Android";
const summary = cleanHtml(appInfo?.[73]?.[0]?.[1] || ld.description || "");
const fullDescription = cleanHtml(appInfo?.[72]?.[0]?.[1] || ld.description || summary);
const icon = appInfo?.[95]?.[0]?.[3]?.[2] || ld.image || "";
const headerImage = appInfo?.[96]?.[0]?.[3]?.[2] || null;
const screenshots = (appInfo?.[78]?.[0] || [])
.map((x) => x?.[3]?.[2])
.filter(Boolean);
const ratingScore = parseFloat(ld.aggregateRating?.ratingValue || appInfo?.[51]?.[0]?.[1] || "0");
const ratingCount = parseInt(ld.aggregateRating?.ratingCount || appInfo?.[51]?.[2]?.[1] || "0", 10) || 0;
const reviewsCount = appInfo?.[51]?.[3]?.[1] || 0;
const histogram = {
1: appInfo?.[51]?.[1]?.[1]?.[1] || 0,
2: appInfo?.[51]?.[1]?.[2]?.[1] || 0,
3: appInfo?.[51]?.[1]?.[3]?.[1] || 0,
4: appInfo?.[51]?.[1]?.[4]?.[1] || 0,
5: appInfo?.[51]?.[1]?.[5]?.[1] || 0
};
const installsFormatted = appInfo?.[13]?.[0] || "10.000+";
const installsExact = appInfo?.[13]?.[1] || 0;
const rawCategory = appInfo?.[79]?.[0]?.[0] || ld.applicationCategory || "";
const categoryName = Array.isArray(rawCategory) ? rawCategory[0] : rawCategory;
const categoryId = appInfo?.[79]?.[0]?.[1] || ld.applicationCategory || "";
const developerName = appInfo?.[37]?.[0] || ld.author?.name || "Developer";
const developerDevId = appInfo?.[68]?.[2] || null;
const developerWebsite = appInfo?.[69]?.[0]?.[5]?.[2] || ld.author?.url || null;
const developerEmail = appInfo?.[69]?.[1]?.[0] || null;
const developerAddress = appInfo?.[69]?.[4]?.[2]?.[0] || null;
const developerPhone = appInfo?.[69]?.[4]?.[3] || null;
const offersPrice = ld.offers?.[0]?.price;
const isFree = !offersPrice || offersPrice === "0";
const price = isFree ? "Gratis" : `${ld.offers?.[0]?.priceCurrency || ""} ${offersPrice}`.trim();
const inAppPurchases = appInfo?.[19]?.[0] || null;
const contentRating = appInfo?.[9]?.[0] || ld.contentRating || "Semua Umur";
const contentRatingIcon = appInfo?.[9]?.[1]?.[3]?.[2] || null;
const version = appInfo?.[140]?.[0]?.[0]?.[0] || null;
const androidVersion = appInfo?.[140]?.[1]?.[1]?.[0]?.[1] || null;
const released = appInfo?.[10]?.[0] || null;
const updatedAt = appInfo?.[145]?.[0]?.[0] || "-";
const privacyPolicy = appInfo?.[99]?.[0]?.[5]?.[2] || null;
const whatsNew = cleanHtml(appInfo?.[144]?.[1]?.[1] || "");
return {
status: true,
data: {
package_id: packageId,
title,
summary,
description: fullDescription,
category: {
name: categoryName,
id: categoryId
},
developer: {
name: developerName,
dev_id: developerDevId,
website: developerWebsite,
email: developerEmail,
address: developerAddress,
phone: developerPhone
},
rating: {
score: ratingScore ? Number(ratingScore.toFixed(2)) : 0,
ratings_count: ratingCount,
reviews_count: reviewsCount,
ratings_formatted: formatNumber(ratingCount),
histogram
},
installs: {
formatted: installsFormatted,
approximate: installsExact
},
price: {
is_free: isFree,
display: price,
in_app_purchases: inAppPurchases
},
content_rating: {
label: contentRating,
icon: contentRatingIcon
},
version: {
current: version,
android_required: androidVersion
},
released,
updated_at: updatedAt,
whats_new: whatsNew || null,
privacy_policy: privacyPolicy,
media: {
icon,
header_image: headerImage,
screenshots
},
recent_reviews: reviews,
playstore_url: `https://play.google.com/store/apps/details?id=${packageId}`
}
};
}
// Module exports
if (typeof module !== "undefined" && module.exports) {
module.exports = { scrapePlayStore };
}
// CLI Runner Konsisten 1:1
if (require.main === module) {
const input = process.argv[2] || "com.flow.mobile";
scrapePlayStore(input)
.then((res) => {
console.log(JSON.stringify(res, null, 2));
})
.catch((err) => {
console.error(JSON.stringify({ status: false, error: err.message }, null, 2));
process.exit(1);
});
}