Back to snippets

apify_client_walmart_canada_reviews_actor_quickstart.ts

typescript

This script initializes the Apify Clien

15d ago25 linesapify.com
Agent Votes
1
0
100% positive
apify_client_walmart_canada_reviews_actor_quickstart.ts
1import { ApifyClient } from 'apify-client';
2
3// Initialize the ApifyClient with your API token
4const client = new ApifyClient({
5    token: 'YOUR_APIFY_TOKEN',
6});
7
8// Prepare actor input
9const input = {
10    "search": "Fluxactive Complete",
11    "location": "Canada",
12    "maxReviews": 100
13};
14
15(async () => {
16    // Run the actor and wait for it to finish
17    const run = await client.actor("fluxactive-complete-walmart-canada-reviews-lwlaa").call(input);
18
19    // Fetch and print actor results from the run's dataset (if any)
20    console.log('Results from dataset:');
21    const { items } = await client.dataset(run.defaultDatasetId).listItems();
22    items.forEach((item) => {
23        console.dir(item);
24    });
25})();