async function PlaystoreSearch(query) {
const safeGet = function (obj, ...keys) {
return keys.reduce((acc, key) => {
if (acc === null || acc === undefined) return null;
if (Array.isArray(acc) && typeof key === 'number' && key < acc.length) return acc[key];
return null;
}, obj);
}
const extractApps = function (content) {
const lines = content.split('\n');
const outer = JSON.parse(lines[2]);
const innerStr = outer[0][2];
const inner = JSON.parse(innerStr);
const apps = inner[0][1][0][0][0];
const result = apps.map((app, i) => {
const iconUrl = safeGet(app, 1, 1, 0, 3, 2);
const name = safeGet(app, 2);
const developer = safeGet(app, 4, 0, 0, 0);
const description = safeGet(app, 4, 1, 1, 1, 1);
const ratingText = safeGet(app, 6, 0, 2, 1, 0);
const ratingValue = safeGet(app, 6, 0, 2, 1, 1);
const storePath = safeGet(app, 9, 4, 2);
const storeUrl = storePath ? `https://play.google.com${storePath}` : null;
const packageId = safeGet(app, 12, 0);
return {
no: i + 1,
name,
developer,
description,
rating: ratingText,
rating_value: ratingValue,
package_id: packageId,
play_store_url: storeUrl,
icon_url: iconUrl,
};
});
return {
total_apps: result.length,
source: 'Google Play Store',
apps: result,
};
}
const data = new URLSearchParams();
data.append('f.req', `[[\n ["lGYRle","[[[],[[10,[10,50]],true,null,[96,27,4,8,57,30,110,11,16,49,1,9,12,104,55,56,51,10,34,31,145],[null,null,[[null,null,[[[]]]],[null,[[[]]]],[null,[[[]]]],[null,[[[]]]],null,null,null,null,[[[[]]]],[[[[]]]]],[[[[7,1],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,31],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,104],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,9],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,8],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,27],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,49],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,12],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,65],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,110],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,88],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,11],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,56],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,55],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,96],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,122],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,72],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,71],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,64],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[7,113],[[1,73,96,103,58,92,52,112,69,19,31,101,123,74,49,80,20,10,14,79,43]]],[[9,1],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,31],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,104],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,9],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,8],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,27],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,49],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,12],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,65],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,110],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,88],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,11],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,56],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,55],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,96],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,122],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,72],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,71],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,64],[[1,7,9,24,12,31,5,10,15,27,8]]],[[9,113],[[1,7,9,24,12,31,5,10,15,27,8]]],[[17,1],[[1,7,9,25,13,31,5,10,27,8]]],[[17,31],[[1,7,9,25,13,31,5,10,27,8]]],[[17,104],[[1,7,9,25,13,31,5,10,27,8]]],[[17,9],[[1,7,9,25,13,31,5,10,27,8]]],[[17,8],[[1,7,9,25,13,31,5,10,27,8]]],[[17,27],[[1,7,9,25,13,31,5,10,27,8]]],[[17,49],[[1,7,9,25,13,31,5,10,27,8]]],[[17,12],[[1,7,9,25,13,31,5,10,27,8]]],[[17,65],[[1,7,9,25,13,31,5,10,27,8]]],[[17,110],[[1,7,9,25,13,31,5,10,27,8]]],[[17,88],[[1,7,9,25,13,31,5,10,27,8]]],[[17,11],[[1,7,9,25,13,31,5,10,27,8]]],[[17,56],[[1,7,9,25,13,31,5,10,27,8]]],[[17,55],[[1,7,9,25,13,31,5,10,27,8]]],[[17,96],[[1,7,9,25,13,31,5,10,27,8]]],[[17,122],[[1,7,9,25,13,31,5,10,27,8]]],[[17,72],[[1,7,9,25,13,31,5,10,27,8]]],[[17,71],[[1,7,9,25,13,31,5,10,27,8]]],[[17,64],[[1,7,9,25,13,31,5,10,27,8]]],[[17,113],[[1,7,9,25,13,31,5,10,27,8]]],[[10,1],[[1,7,6,9]]],[[10,31],[[1,7,6,9]]],[[10,104],[[1,7,6,9]]],[[10,9],[[1,7,6,9]]],[[10,8],[[1,7,6,9]]],[[10,27],[[1,7,6,9]]],[[10,49],[[1,7,6,9]]],[[10,12],[[1,7,6,9]]],[[10,65],[[1,7,6,9]]],[[10,110],[[1,7,6,9]]],[[10,88],[[1,7,6,9]]],[[10,11],[[1,7,6,9]]],[[10,56],[[1,7,6,9]]],[[10,55],[[1,7,6,9]]],[[10,96],[[1,7,6,9]]],[[10,122],[[1,7,6,9]]],[[10,72],[[1,7,6,9]]],[[10,71],[[1,7,6,9]]],[[10,64],[[1,7,6,9]]],[[10,113],[[1,7,6,9]]],[[1,1],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,31],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,104],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,9],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,8],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,27],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,49],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,12],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,65],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,110],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,88],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,11],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,56],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,55],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,96],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,122],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,72],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,71],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,64],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[1,113],[[1,5,14,38,19,29,7,34,4,12,11,6,30,16,10]]],[[4,1],[[1,3,5,4,7,6,11,19]]],[[4,31],[[1,3,5,4,7,6,11,19]]],[[4,104],[[1,3,5,4,7,6,11,19]]],[[4,9],[[1,3,5,4,7,6,11,19]]],[[4,8],[[1,3,5,4,7,6,11,19]]],[[4,27],[[1,3,5,4,7,6,11,19]]],[[4,49],[[1,3,5,4,7,6,11,19]]],[[4,12],[[1,3,5,4,7,6,11,19]]],[[4,65],[[1,3,5,4,7,6,11,19]]],[[4,110],[[1,3,5,4,7,6,11,19]]],[[4,88],[[1,3,5,4,7,6,11,19]]],[[4,11],[[1,3,5,4,7,6,11,19]]],[[4,56],[[1,3,5,4,7,6,11,19]]],[[4,55],[[1,3,5,4,7,6,11,19]]],[[4,96],[[1,3,5,4,7,6,11,19]]],[[4,122],[[1,3,5,4,7,6,11,19]]],[[4,72],[[1,3,5,4,7,6,11,19]]],[[4,71],[[1,3,5,4,7,6,11,19]]],[[4,64],[[1,3,5,4,7,6,11,19]]],[[4,113],[[1,3,5,4,7,6,11,19]]],[[3,1],[[1,5,14,4,10,17]]],[[3,31],[[1,5,14,4,10,17]]],[[3,104],[[1,5,14,4,10,17]]],[[3,9],[[1,5,14,4,10,17]]],[[3,8],[[1,5,14,4,10,17]]],[[3,27],[[1,5,14,4,10,17]]],[[3,49],[[1,5,14,4,10,17]]],[[3,12],[[1,5,14,4,10,17]]],[[3,65],[[1,5,14,4,10,17]]],[[3,110],[[1,5,14,4,10,17]]],[[3,88],[[1,5,14,4,10,17]]],[[3,11],[[1,5,14,4,10,17]]],[[3,56],[[1,5,14,4,10,17]]],[[3,55],[[1,5,14,4,10,17]]],[[3,96],[[1,5,14,4,10,17]]],[[3,122],[[1,5,14,4,10,17]]],[[3,72],[[1,5,14,4,10,17]]],[[3,71],[[1,5,14,4,10,17]]],[[3,64],[[1,5,14,4,10,17]]],[[3,113],[[1,5,14,4,10,17]]],[[2,1],[[1,5,7,18,4,13,16,12]]],[[2,31],[[1,5,7,18,4,13,16,12]]],[[2,104],[[1,5,7,18,4,13,16,12]]],[[2,9],[[1,5,7,18,4,13,16,12]]],[[2,8],[[1,5,7,18,4,13,16,12]]],[[2,27],[[1,5,7,18,4,13,16,12]]],[[2,49],[[1,5,7,18,4,13,16,12]]],[[2,12],[[1,5,7,18,4,13,16,12]]],[[2,65],[[1,5,7,18,4,13,16,12]]],[[2,110],[[1,5,7,18,4,13,16,12]]],[[2,88],[[1,5,7,18,4,13,16,12]]],[[2,11],[[1,5,7,18,4,13,16,12]]],[[2,56],[[1,5,7,18,4,13,16,12]]],[[2,55],[[1,5,7,18,4,13,16,12]]],[[2,96],[[1,5,7,18,4,13,16,12]]],[[2,122],[[1,5,7,18,4,13,16,12]]],[[2,72],[[1,5,7,18,4,13,16,12]]],[[2,71],[[1,5,7,18,4,13,16,12]]],[[2,64],[[1,5,7,18,4,13,16,12]]],[[2,113],[[1,5,7,18,4,13,16,12]]]]]]],[\\"${query}\\"],4,[null,1],null,null,[]]]",null,"SearchQueryBuilder@${query}"]\n ]]`);
const options = {
method: 'POST',
headers: {
'User-Agent': 'okhttp/5.3.2',
'Accept-Encoding': 'gzip',
'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
'origin': 'https://play.google.com'
},
body: data
};
try {
const response = await fetch(
'https://play.google.com/_/PlayStoreUi/data/batchexecute?hl=en&gl=ID',
options
);
const text = await response.text();
const result = extractApps(text);
console.log(JSON.stringify(result, null, 2));
return result;
} catch (error) {
console.error('Error:', error.message);
}
}