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.reddit.com/r/pasta/comments/vwi6jx/pasta_peperoni_and_ricotta_cheese_how_to_make/",
13 "https://www.reddit.com/r/pasta/"
14 ],
15 "searchQueries": [],
16 "searchType": "posts",
17 "searchInSubreddits": [],
18 "sort": "relevance",
19 "timeRange": "all",
20 "minScore": 0,
21 "includeNsfw": true,
22 "includeComments": true,
23 "maxCommentsPerPost": 10,
24 "commentsSort": "top",
25 "commentsOutput": "rows",
26 "maxResultsPerSource": 5,
27 "maxItems": 0,
28 "proxyConfig": {
29 "useApifyProxy": true,
30 "apifyProxyGroups": [
31 "RESIDENTIAL"
32 ]
33 }
34};
35
36
37const run = await client.actor("claygenius/reddit-scraper").call(input);
38
39
40console.log('Results from dataset');
41console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
42const { items } = await client.dataset(run.defaultDatasetId).listItems();
43items.forEach((item) => {
44 console.dir(item);
45});
46
47