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