1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "startUrls": [
12 "https://www.tripadvisor.com/Restaurant_Review-g60763-d25324283-Reviews-Allora_Fifth_Ave-New_York_City_New_York.html",
13 "https://www.tripadvisor.com/Hotel_Review-g60763-d15288822-Reviews-SpringHill_Suites_New_York_Manhattan_Times_Square_South-New_York_City_New_York.html?spAttributionToken=MjMyMTAzMzg"
14 ],
15 "types": [
16 "all"
17 ],
18 "months": [
19 "all"
20 ],
21 "languages": [
22 "all"
23 ],
24 "ratings": [
25 "all"
26 ],
27 "maxItems": 20,
28 "endPage": 1,
29 "customMapFunction": (object) => { return {...object} },
30 "proxy": {
31 "useApifyProxy": true
32 }
33};
34
35
36const run = await client.actor("epctex/tripadvisor-reviews-scraper").call(input);
37
38
39console.log('Results from dataset');
40console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
41const { items } = await client.dataset(run.defaultDatasetId).listItems();
42items.forEach((item) => {
43 console.dir(item);
44});
45
46