1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "listings": [
12 {
13 "subreddit": "entrepreneur",
14 "sort": "hot",
15 "timeframe": "week",
16 "maxPosts": 25
17 },
18 {
19 "subreddit": "startups",
20 "sort": "hot",
21 "timeframe": "week",
22 "maxPosts": 25
23 }
24 ],
25 "searchTerms": [
26 "saas",
27 "startup"
28 ],
29 "searchTargets": [
30 {
31 "query": "startup marketing",
32 "searchSort": "relevance",
33 "timeframe": "week",
34 "maxResults": 25
35 },
36 {
37 "query": "saas pricing",
38 "searchSort": "new",
39 "timeframe": "week",
40 "maxResults": 25
41 }
42 ],
43 "domainTargets": [
44 {
45 "domain": "github.com",
46 "sort": "hot",
47 "timeframe": "week",
48 "maxResults": 100
49 },
50 {
51 "domain": "medium.com",
52 "sort": "new",
53 "timeframe": "week",
54 "maxResults": 50
55 }
56 ],
57 "proxyConfiguration": {
58 "useApifyProxy": true,
59 "apifyProxyGroups": [
60 "RESIDENTIAL"
61 ]
62 }
63};
64
65
66const run = await client.actor("spry_wholemeal/reddit-scraper").call(input);
67
68
69console.log('Results from dataset');
70console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
71const { items } = await client.dataset(run.defaultDatasetId).listItems();
72items.forEach((item) => {
73 console.dir(item);
74});
75
76