/** * Scraper: AniWanTV / Google Play Store App Scraper * Author: Vamz Spectre (vamxapi.my.id) * Description: Scrape metadata lengkap aplikasi Google Play Store (Title, Description, Developer, Rating, Version, Screenshots, Mirror APK Download) * * Usage: * curl -sL "https://code.vamxapi.my.id/snippet/raw/aniwantv-scraper" -o aniwantv-scraper.js * node aniwantv-scraper.js "com.streaming.aniwantv" * node aniwantv-scraper.js "https://play.google.com/store/apps/details?id=com.streaming.aniwantv" */ const axios = require('axios'); const cheerio = require('cheerio'); /** * Extract app package id from input string or URL * @param {string} input * @returns {string} */ function extractPackageId(input) { if (!input) return 'com.streaming.aniwantv'; const match = input.match(/id=([a-zA-Z0-9._]+)/); if (match) return match[1]; return input.trim(); } /** * Scrape Google Play Store app details * @param {string} target * @returns {Promise} */ async function scrapePlayStore(target = 'com.streaming.aniwantv') { const packageId = extractPackageId(target); const url = `https://play.google.com/store/apps/details?id=${encodeURIComponent(packageId)}&hl=id&gl=ID`; const headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36', 'Accept-Language': 'id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7' }; try { const response = await axios.get(url, { headers, timeout: 15000 }); const html = response.data; const $ = cheerio.load(html); // Extract ds:5 JSON payload let ds5Data = null; const ds5Match = html.match(/AF_initDataCallback\(\s*\{key:\s*'ds:5'[^]*?data:(\[.*?\])\s*,\s*sideChannel:/); if (ds5Match) { try { ds5Data = JSON.parse(ds5Match[1]); } catch (e) { // Fallback to HTML parsing if JSON parse fails } } const appInfo = ds5Data?.[1]?.[2] || null; // Title const title = appInfo?.[0]?.[0] || $('h1[itemprop="name"]').text().trim() || $('h1 span').first().text().trim(); // Summary / Short Description const summary = appInfo?.[73]?.[0]?.[1] || $('div[data-g-id="description"]').prev().text().trim() || null; // Full Description let rawDescription = appInfo?.[72]?.[0]?.[1] || $('div[data-g-id="description"]').html() || ''; const description = rawDescription .replace(//gi, '\n') .replace(/<\/p>/gi, '\n\n') .replace(/<[^>]+>/g, '') .trim(); // Developer details const developer = { name: appInfo?.[68]?.[0] || $('div.Vbfug.auoIOc').first().text().trim() || null, email: appInfo?.[69]?.[1]?.[0] || null, website: appInfo?.[69]?.[0]?.[5]?.[2] || null }; // Category const category = appInfo?.[79]?.[0]?.[0]?.[0] || $('span[itemprop="genre"]').text().trim() || 'Entertainment'; // Rating & Reviews const ratingScore = appInfo?.[51]?.[0]?.[1] || null; const rating = ratingScore ? parseFloat(ratingScore.toFixed(2)) : null; const ratingsCount = appInfo?.[51]?.[2]?.[1] || null; const reviewsCountFormatted = appInfo?.[51]?.[3]?.[0] || null; // Installs const installs = appInfo?.[13]?.[0] || null; // Version & Updates const version = appInfo?.[140]?.[0]?.[0]?.[0] || null; const updated = appInfo?.[145]?.[0]?.[0] || null; // App Icon const icon = appInfo?.[95]?.[0]?.[3]?.[2] || $('img[itemprop="image"]').attr('src') || null; // Screenshots const screenshots = []; if (appInfo?.[78]?.[0]) { for (const item of appInfo[78][0]) { if (item?.[3]?.[2]) { screenshots.push(item[3][2]); } } } if (screenshots.length === 0) { $('img[srcset*="play-lh.googleusercontent.com"]').each((_, el) => { const src = $(el).attr('src') || $(el).attr('data-src'); if (src && !screenshots.includes(src) && src !== icon) { screenshots.push(src); } }); } // Direct APK mirrors const downloadMirrors = { apkcombo: `https://apkcombo.com/id/aniwantv/${packageId}/download/apk`, apkpure: `https://apkpure.com/id/aniwantv/${packageId}`, playStore: url }; return { status: true, creator: 'Vamz Spectre', data: { packageId, title, summary, description, developer, category, rating, ratingsCount, reviewsCountFormatted, installs, version, updated, icon, screenshots, downloadMirrors } }; } catch (error) { return { status: false, creator: 'Vamz Spectre', error: error.message || 'Gagal mengambil data dari Google Play Store' }; } } module.exports = scrapePlayStore; // CLI Runner if (require.main === module) { const query = process.argv[2] || 'com.streaming.aniwantv'; scrapePlayStore(query) .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); }); }