1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "searchQueries": [
12 "openai",
13 "chatgpt",
14 "openai api"
15 ],
16 "searchCommunityName": "r/artificial",
17 "startUrls": [
18 {
19 "url": "https://www.reddit.com/r/artificial/"
20 },
21 {
22 "url": "https://www.reddit.com/r/OpenAI/search/?q=gpt-5&restrict_sr=1"
23 }
24 ],
25 "subredditNames": [
26 "r/artificial",
27 "OpenAI"
28 ],
29 "userNames": [
30 "u/spez"
31 ]
32};
33
34
35const run = await client.actor("maximedupre/reddit-scraper").call(input);
36
37
38console.log('Results from dataset');
39console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
40const { items } = await client.dataset(run.defaultDatasetId).listItems();
41items.forEach((item) => {
42 console.dir(item);
43});
44
45