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