forked from SaintMick/google-maps-scraper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_more_data.js
52 lines (41 loc) · 939 Bytes
/
get_more_data.js
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
function parse() {
let inputString = window.APP_INITIALIZATION_STATE[3][6]
let substringToRemove = ")]}'"
let modifiedString
if (inputString.startsWith(substringToRemove)) {
modifiedString = inputString.slice(substringToRemove.length)
} else {
}
return JSON.parse(modifiedString)
}
function get_rating(data) {
return data?.[6]?.[4]?.[7]
}
function get_reviews(data) {
return data?.[6]?.[4]?.[8]
}
function get_title(data) {
return data?.[6]?.[11]
}
function get_address(data) {
return data?.[6]?.[18]
}
function get_main_category(data) {
return data?.[6]?.[13]?.[0]
}
function get_more_data() {
let data = parse()
let rating = get_rating(data)
let reviews = get_reviews(data)
let title = get_title(data)
let address = get_address(data)
let main_category = get_main_category(data)
return {
title,
main_category,
rating,
reviews,
address,
}
}
return get_more_data()