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 "popular"
13 ],
14 "searches": [],
15 "startUrls": [],
16 "searchPosts": true,
17 "searchComments": false,
18 "searchCommunities": false,
19 "searchUsers": false,
20 "sort": "new",
21 "time": "all",
22 "includeNSFW": false,
23 "skipComments": true,
24 "skipUserPosts": false,
25 "skipUserComments": false,
26 "skipCommunityInfo": false,
27 "maxItems": 100,
28 "maxComments": 100,
29 "maxCommentDepth": 10
30};
31
32
33const run = await client.actor("solidcode/reddit-scraper").call(input);
34
35
36console.log('Results from dataset');
37console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
38const { items } = await client.dataset(run.defaultDatasetId).listItems();
39items.forEach((item) => {
40 console.dir(item);
41});
42
43