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.reddit.com/r/pasta/comments/vwi6jx/pasta_peperoni_and_ricotta_cheese_how_to_make/"
14        }
15    ],
16    "sort": "new",
17    "maxItems": 10,
18    "maxPostCount": 10,
19    "maxComments": 10,
20    "maxCommunitiesCount": 2,
21    "maxUserCount": 2,
22    "scrollTimeout": 40,
23    "proxy": {
24        "useApifyProxy": true,
25        "apifyProxyGroups": [
26            "RESIDENTIAL"
27        ]
28    }
29};
30
31
32const run = await client.actor("trudax/reddit-scraper-lite").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