1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "places": [
12 {
13 "title": "Sample Bakery (demo)",
14 "subTitle": null,
15 "description": "A fictional demo bakery used to seed sample input for this Actor.",
16 "ownerDescription": null,
17 "price": "$$",
18 "categoryName": "Bakery",
19 "categories": [
20 "Bakery",
21 "Cafe"
22 ],
23 "address": "1 Demo Street, Sample City, Sample Prefecture, Japan",
24 "neighborhood": "Sample District",
25 "street": "1 Demo Street",
26 "city": "Sample City",
27 "postalCode": "100-0001",
28 "state": "Sample Prefecture",
29 "countryCode": "JP",
30 "website": "https://example.com",
31 "phone": "+81 3-1234-5678",
32 "phoneUnformatted": "+81312345678",
33 "claimThisBusiness": false,
34 "location": {
35 "lat": 35.681236,
36 "lng": 139.767125
37 },
38 "menu": null,
39 "totalScore": 4.7,
40 "permanentlyClosed": false,
41 "temporarilyClosed": false,
42 "placeId": "DEMO_PLACE_ID_001",
43 "fid": "demo:001",
44 "cid": "1000000000000000001",
45 "reviewsCount": 120,
46 "imagesCount": 25,
47 "openingHours": [
48 {
49 "day": "Monday",
50 "hours": "8 AM to 6 PM"
51 },
52 {
53 "day": "Tuesday",
54 "hours": "8 AM to 6 PM"
55 }
56 ],
57 "url": "https://www.google.com/maps/search/?api=1&query=Sample%20Bakery%20demo&query_place_id=DEMO_PLACE_ID_001",
58 "searchString": "bakery",
59 "language": "en",
60 "rank": 1,
61 "isAdvertisement": false
62 },
63 {
64 "title": "Sample Nail Salon (demo)",
65 "subTitle": null,
66 "description": null,
67 "ownerDescription": null,
68 "price": null,
69 "categoryName": "Nail salon",
70 "categories": [
71 "Nail salon"
72 ],
73 "address": "2 Demo Street, Sample City, Sample Prefecture, Japan",
74 "neighborhood": "Sample District",
75 "street": "2 Demo Street",
76 "city": "Sample City",
77 "postalCode": "100-0002",
78 "state": "Sample Prefecture",
79 "countryCode": "JP",
80 "website": null,
81 "phone": "",
82 "phoneUnformatted": "",
83 "claimThisBusiness": true,
84 "location": {
85 "lat": 35.6813,
86 "lng": 139.7672
87 },
88 "menu": null,
89 "totalScore": 4.2,
90 "permanentlyClosed": false,
91 "temporarilyClosed": false,
92 "placeId": "DEMO_PLACE_ID_002",
93 "fid": "demo:002",
94 "cid": "1000000000000000002",
95 "reviewsCount": 3,
96 "imagesCount": 1,
97 "openingHours": [],
98 "url": "https://www.google.com/maps/search/?api=1&query=Sample%20Nail%20Salon%20demo&query_place_id=DEMO_PLACE_ID_002",
99 "searchString": "nail salon",
100 "language": "en",
101 "rank": 2,
102 "isAdvertisement": false
103 },
104 {
105 "title": "Sample Yoga Studio (demo)",
106 "subTitle": null,
107 "description": "A fictional demo studio used to test unreachable-website handling.",
108 "ownerDescription": null,
109 "price": null,
110 "categoryName": "Yoga studio",
111 "categories": [
112 "Yoga studio",
113 "Fitness center"
114 ],
115 "address": "3 Demo Street, Sample City, Sample Prefecture, Japan",
116 "neighborhood": "Sample District",
117 "street": "3 Demo Street",
118 "city": "Sample City",
119 "postalCode": "100-0003",
120 "state": "Sample Prefecture",
121 "countryCode": "JP",
122 "website": "https://no-such-site.invalid",
123 "phone": "+81 3-9876-5432",
124 "phoneUnformatted": "+81398765432",
125 "claimThisBusiness": false,
126 "location": {
127 "lat": 35.6814,
128 "lng": 139.7673
129 },
130 "menu": null,
131 "totalScore": 4.5,
132 "permanentlyClosed": false,
133 "temporarilyClosed": false,
134 "placeId": "DEMO_PLACE_ID_003",
135 "fid": "demo:003",
136 "cid": "1000000000000000003",
137 "reviewsCount": 58,
138 "imagesCount": 10,
139 "openingHours": [
140 {
141 "day": "Monday",
142 "hours": "7 AM to 9 PM"
143 }
144 ],
145 "url": "https://www.google.com/maps/search/?api=1&query=Sample%20Yoga%20Studio%20demo&query_place_id=DEMO_PLACE_ID_003",
146 "searchString": "yoga studio",
147 "language": "en",
148 "rank": 3,
149 "isAdvertisement": false
150 }
151 ]
152};
153
154
155const run = await client.actor("reverenced_garnet/apify-gmaps-nap-checker").call(input);
156
157
158console.log('Results from dataset');
159console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
160const { items } = await client.dataset(run.defaultDatasetId).listItems();
161items.forEach((item) => {
162 console.dir(item);
163});
164
165