1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "enableListingDiscovery": true,
12 "listingTasks": [
13 {
14 "category": "restaurant",
15 "location": "New York",
16 "maxItems": 50
17 },
18 {
19 "category": "hotel",
20 "location": "Las Vegas",
21 "maxItems": 30
22 }
23 ],
24 "maxPagesPerTask": 20,
25 "enrichListings": true,
26 "maxReviewsPerPlace": 30,
27 "maxItems": 1000,
28 "proxyConfiguration": {
29 "useApifyProxy": true,
30 "apifyProxyGroups": [
31 "RESIDENTIAL"
32 ],
33 "apifyProxyCountry": "US"
34 }
35};
36
37
38const run = await client.actor("b2b_leads/tripadvisor-real-time-data").call(input);
39
40
41console.log('Results from dataset');
42console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
43const { items } = await client.dataset(run.defaultDatasetId).listItems();
44items.forEach((item) => {
45 console.dir(item);
46});
47
48