-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathGooglePlayScraper.js
More file actions
42 lines (36 loc) · 1.42 KB
/
GooglePlayScraper.js
File metadata and controls
42 lines (36 loc) · 1.42 KB
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
const unirest = require("unirest");
const cheerio = require("cheerio");
const getGooglePlayData = async() => {
let url = "https://play.google.com/store/apps"
let response = await unirest
.get(url)
.headers({
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
})
const $ = cheerio.load(response.body)
let category = [], organic_results = [];
$(".kcen6d").each((i,el) => {
category[i] = $(el).text()
})
$("section").each((i,el) => {
let results = [];
if(category[i] !== "Top charts" && category[i] !== undefined)
{
$(el).find(".ULeU3b").each((i,el) => {
results.push({
app_name: $(el).find(".Epkrse").text(),
rating: parseFloat($(el).find(".LrNMN").text()),
thumbnail: $(el).find(".TjRVLb img").attr("src"),
link: "https://play.google.com" + $(el).find("a").attr("href"),
})
})
organic_results.push({
category: category[i],
results: results
})
}
})
console.log(organic_results[0]);
};
getGooglePlayData();