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