/**
* 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(/
/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