1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "mode": "subreddit",
12 "source": "archive",
13 "subreddits": [
14 "programming"
15 ],
16 "postUrls": [],
17 "usernames": [],
18 "searchQuery": "",
19 "maxItems": 2,
20 "maxPosts": 2,
21 "maxComments": 5,
22 "maxDepth": 6,
23 "includeComments": false,
24 "includePost": true,
25 "sort": "hot",
26 "timeFilter": "day",
27 "commentSort": "confidence",
28 "includeNSFW": false,
29 "includeSubredditInfo": false,
30 "includeSubredditRules": false,
31 "includeProfileInfo": true,
32 "sections": [
33 "posts"
34 ],
35 "searchPosts": true,
36 "searchComments": false,
37 "searchCommunities": false,
38 "searchUsers": false,
39 "maxCommunities": 0,
40 "maxUsers": 0,
41 "onlyNew": false,
42 "stateKey": "reddit-mcp-state",
43 "failOnEmpty": false,
44 "maxProxyBytesMb": 50,
45 "proxyMode": "none",
46 "authors": [],
47 "excludeAuthors": [],
48 "excludeKeywords": [],
49 "excludeStickied": false,
50 "excludeRemoved": false,
51 "excludeCrossposts": false,
52 "excludeSpoilers": false,
53 "excludeLocked": false,
54 "excludeDeletedAuthor": false,
55 "excludeArchived": false,
56 "onlyWithFlair": false,
57 "onlyOriginalContent": false,
58 "restrictSubreddits": []
59};
60
61
62const run = await client.actor("nimbryxo-studio/reddit-multi-mode-scraper-for-posts-comments").call(input);
63
64
65console.log('Results from dataset');
66console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
67const { items } = await client.dataset(run.defaultDatasetId).listItems();
68items.forEach((item) => {
69 console.dir(item);
70});
71
72