1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "locations": [
12 {
13 "title": "Harbor Bean Coffee - Central Station",
14 "address": "120 Market Street, Springfield, IL 62701",
15 "phone": "(217) 555-0101",
16 "website": "https://www.harborbean.example/",
17 "openingHours": "Mon-Fri: 7 AM - 7 PM; Sat-Sun: 8 AM - 5 PM",
18 "location": {
19 "lat": 39.8001,
20 "lng": -89.6435
21 }
22 },
23 {
24 "title": "Harbor Bean Coffee - Riverside",
25 "address": "48 River Rd, Springfield, IL 62702",
26 "phone": "217-555-0102",
27 "website": "https://harborbean.example/locations/riverside",
28 "openingHours": "Mon-Fri: 7 AM - 7 PM; Sat-Sun: 8 AM - 5 PM",
29 "location": {
30 "lat": 39.825,
31 "lng": -89.62
32 }
33 },
34 {
35 "title": "Harbour Bean Cafe",
36 "address": "300 Oak Avenue, Springfield, IL 62703",
37 "phone": "(217) 555-0103",
38 "website": "http://harborbean.example?utm_source=listing",
39 "openingHours": "Mon-Fri: 07:00-19:00; Sat-Sun: 08:00-17:00",
40 "location": {
41 "lat": 39.77,
42 "lng": -89.66
43 }
44 },
45 {
46 "title": "HARBOR BEAN COFFEE",
47 "address": "120 Market St, Springfield, IL 62701",
48 "phone": "(217) 555-0101",
49 "website": "https://harborbean.example/",
50 "openingHours": "Mon-Fri: 7 AM - 7 PM; Sat-Sun: 8 AM - 5 PM",
51 "location": {
52 "lat": 39.80012,
53 "lng": -89.64352
54 }
55 },
56 {
57 "title": "Harbor Bean Coffee - Lakeside",
58 "address": "9 Lake Drive, Springfield, IL",
59 "phone": "217.555.0104",
60 "website": "https://harborbean-shop.example/lakeside"
61 },
62 {
63 "title": "Harbor Bean Coffee - Airport",
64 "address": "1 Terminal Road, Springfield, IL 62707",
65 "phone": "(217) 555-0105",
66 "website": "https://harborbean.example/locations/airport",
67 "openingHours": "Mon-Fri: 5 AM - 9 PM; Sat-Sun: 6 AM - 9 PM",
68 "location": {
69 "lat": 39.844,
70 "lng": -89.677
71 }
72 }
73 ]
74};
75
76
77const run = await client.actor("practical_ai_lab_jp/pal-maps-chain-location-consistency").call(input);
78
79
80console.log('Results from dataset');
81console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
82const { items } = await client.dataset(run.defaultDatasetId).listItems();
83items.forEach((item) => {
84 console.dir(item);
85});
86
87