1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "proxy": {
12 "ip": "http://proxy.example.com",
13 "port": "1080",
14 "username": "example_username",
15 "password": "example_password"
16 },
17 "origin": "https://www.reddit.com",
18 "referer": "https://www.reddit.com/",
19 "maxCount": 10,
20 "sort": "best",
21 "csrfToken": "example_csrfToken",
22 "userAgent": "Mozilla/5.0 ...",
23 "redditHost": "www.reddit.com",
24 "cookieHeader": "session=example",
25 "subRedditUrl": "https://www.reddit.com/r/codex/",
26 "acceptLanguage": "en-US,en;q=0.9"
27};
28
29
30const run = await client.actor("automationagents/reddit-subreddit-posts-export").call(input);
31
32
33console.log('Results from dataset');
34console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
35const { items } = await client.dataset(run.defaultDatasetId).listItems();
36items.forEach((item) => {
37 console.dir(item);
38});
39
40