1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "startUrls": [
10 "https://www.reddit.com/r/pasta/comments/vwi6jx/pasta_peperoni_and_ricotta_cheese_how_to_make/",
11 "https://www.reddit.com/r/pasta/",
12 ],
13 "searchQueries": [],
14 "searchType": "posts",
15 "searchInSubreddits": [],
16 "sort": "relevance",
17 "timeRange": "all",
18 "minScore": 0,
19 "includeNsfw": True,
20 "includeComments": True,
21 "maxCommentsPerPost": 10,
22 "commentsSort": "top",
23 "commentsOutput": "rows",
24 "maxResultsPerSource": 5,
25 "maxItems": 0,
26 "proxyConfig": {
27 "useApifyProxy": True,
28 "apifyProxyGroups": ["RESIDENTIAL"],
29 },
30}
31
32
33run = client.actor("claygenius/reddit-scraper").call(run_input=run_input)
34
35
36print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
37for item in client.dataset(run.default_dataset_id).iterate_items():
38 print(item)
39
40