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 "forhire"
13 ],
14 "startUrls": [
15 {
16 "url": "https://www.reddit.com/r/webdev/"
17 }
18 ],
19 "users": [
20 "spez"
21 ],
22 "communities": [
23 "technology"
24 ],
25 "searchQueries": [
26 "remote developer"
27 ],
28 "searchFor": [
29 "posts"
30 ],
31 "sort": "hot",
32 "time": "week",
33 "includeNSFW": false,
34 "includeSelftext": true,
35 "includeComments": false,
36 "maxComments": 20,
37 "maxCommentDepth": 4,
38 "includeMedia": false,
39 "maxItems": 50,
40 "maxPostsPerSource": 25,
41 "maxPages": 1,
42 "ignoreStartUrls": false,
43 "maxRetries": 3,
44 "requestDelayMs": 300,
45 "debug": false
46};
47
48
49const run = await client.actor("myagizm/reddit-scraper").call(input);
50
51
52console.log('Results from dataset');
53console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
54const { items } = await client.dataset(run.defaultDatasetId).listItems();
55items.forEach((item) => {
56 console.dir(item);
57});
58
59