1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "rows": [
12 {
13 "title": "Joe's Pizza",
14 "address": "7 Carmine St, New York, NY",
15 "location": {
16 "lat": 40.7303,
17 "lng": -74.0021
18 },
19 "openingHours": [
20 {
21 "day": "Monday",
22 "hours": "10 AM to 4 AM"
23 },
24 {
25 "day": "Tuesday",
26 "hours": "10 AM to 4 AM"
27 },
28 {
29 "day": "Wednesday",
30 "hours": "10 AM to 4 AM"
31 },
32 {
33 "day": "Thursday",
34 "hours": "10 AM to 4 AM"
35 },
36 {
37 "day": "Friday",
38 "hours": "10 AM to 5 AM"
39 },
40 {
41 "day": "Saturday",
42 "hours": "10 AM to 5 AM"
43 },
44 {
45 "day": "Sunday",
46 "hours": "10 AM to 4 AM"
47 }
48 ]
49 },
50 {
51 "title": "Boulangerie Paul",
52 "address": "77 Rue de Rennes, Paris",
53 "location": {
54 "lat": 48.8467,
55 "lng": 2.3262
56 },
57 "openingHours": "lundi: 07:00–20:00; mardi: 07:00–20:00; mercredi: 07:00–20:00; jeudi: 07:00–20:00; vendredi: 07:00–20:00; samedi: 08:00–19:00; dimanche: Fermé"
58 },
59 {
60 "title": "Cafe Einstein Stammhaus",
61 "address": "Kurfürstenstraße 58, Berlin",
62 "location": {
63 "lat": 52.5012,
64 "lng": 13.3434
65 },
66 "openingHours": "Montag - Freitag 8:00 bis 22:00 Uhr, Samstag und Sonntag 9:00 bis 23:00 Uhr"
67 },
68 {
69 "title": "Farmacia Central",
70 "address": "Gran Via 12, Madrid",
71 "location": {
72 "lat": 40.42,
73 "lng": -3.705
74 },
75 "openingHours": "lunes a viernes 9:30-14:00 y 17:00-20:30; sábado 10:00-14:00; domingo cerrado"
76 },
77 {
78 "title": "Night Owl Gym",
79 "address": "1 Main St, Austin, TX",
80 "location": {
81 "lat": 30.2672,
82 "lng": -97.7431
83 },
84 "openingHours": "Open 24 hours"
85 },
86 {
87 "title": "Downtown Dental",
88 "address": "Avenue Habib Bourguiba, Tunis",
89 "location": {
90 "lat": 36.8065,
91 "lng": 10.1815
92 },
93 "openingHours": "Mon-Fri 8:30-12:30, 14:30-18:00; Sat 8:30-12:30; Sun closed"
94 },
95 {
96 "title": "Somewhere Tea House",
97 "address": "Somewhere",
98 "openingHours": "Call for hours"
99 }
100 ],
101 "rowsCsv": "",
102 "hoursField": "",
103 "defaultTimezone": "",
104 "checkAt": "",
105 "maxRows": 50000
106};
107
108
109const run = await client.actor("that_red_bird/opening-hours-normalizer").call(input);
110
111
112console.log('Results from dataset');
113console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
114const { items } = await client.dataset(run.defaultDatasetId).listItems();
115items.forEach((item) => {
116 console.dir(item);
117});
118
119