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 {
13 "url": "https://www.trustpilot.com/review/amazon.co.uk"
14 }
15 ],
16 "maxReviews": 10,
17 "googleSheets": {
18 "spreadsheetId": "",
19 "sheetName": "Trustpilot Reviews",
20 "credentialsJson": "{\n \"type\": \"service_account\",\n \"project_id\": \"your-project-id\",\n \"private_key_id\": \"...\",\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n\",\n \"client_email\": \"your-service-account@your-project-id.iam.gserviceaccount.com\",\n \"client_id\": \"...\",\n \"token_uri\": \"https://oauth2.googleapis.com/token\"\n}"
21 },
22 "browserFallbackMode": "http",
23 "trustScoreTrend": {
24 "enabled": true,
25 "historyKey": "TRUST_SCORE_HISTORY",
26 "reportKey": "TRUST_SCORE_TRENDS",
27 "maxSnapshots": 30
28 }
29};
30
31
32const run = await client.actor("netdesignr/trustpilot-reviews-scraper-pro").call(input);
33
34
35console.log('Results from dataset');
36console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
37const { items } = await client.dataset(run.defaultDatasetId).listItems();
38items.forEach((item) => {
39 console.dir(item);
40});
41
42