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 "name": "New York, NY",
14 "latitude": 40.7128,
15 "longitude": -74.006
16 },
17 {
18 "name": "Chicago, IL",
19 "latitude": 41.8781,
20 "longitude": -87.6298
21 }
22 ],
23 "searchTerms": [
24 "pizza"
25 ],
26 "restaurantIds": [],
27 "maxRestaurants": 10,
28 "includeMenuItems": true,
29 "maxMenuItemsPerRestaurant": 20,
30 "proxyConfiguration": {
31 "useApifyProxy": true,
32 "apifyProxyGroups": [
33 "SHADER"
34 ],
35 "apifyProxyCountry": "US"
36 }
37};
38
39
40const run = await client.actor("automation-lab/grubhub-restaurant-menus-scraper").call(input);
41
42
43console.log('Results from dataset');
44console.log(`πΎ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
45const { items } = await client.dataset(run.defaultDatasetId).listItems();
46items.forEach((item) => {
47 console.dir(item);
48});
49
50