1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "mode": "subredditPosts",
12 "subreddits": [
13 "python"
14 ],
15 "includeRules": false,
16 "sort": "new",
17 "timeFilter": "day",
18 "maxPosts": 25,
19 "maxItems": 10000,
20 "fullSubreddit": false,
21 "includeComments": false,
22 "maxCommentsPerPost": 0,
23 "commentSort": "confidence",
24 "includeNSFW": false,
25 "onlyWithFlair": false,
26 "excludeStickied": false,
27 "excludeCrossposts": false,
28 "excludeSpoilers": false,
29 "excludeArchived": false,
30 "excludeLocked": false,
31 "excludeRemoved": false,
32 "onlyOriginalContent": false,
33 "distinguished": "any",
34 "excludeDeletedAuthor": false,
35 "subredditSort": "subscribers"
36};
37
38
39const run = await client.actor("vexaloom-labs/reddit-subreddit-post-and-comment-harvester").call(input);
40
41
42console.log('Results from dataset');
43console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
44const { items } = await client.dataset(run.defaultDatasetId).listItems();
45items.forEach((item) => {
46 console.dir(item);
47});
48
49