1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "searchQuery": "AI",
12 "feeds": [
13 "top",
14 "new",
15 "best",
16 "ask",
17 "show",
18 "job"
19 ],
20 "recordTypes": [
21 "story",
22 "comment",
23 "job",
24 "poll",
25 "pollopt"
26 ],
27 "itemIds": [],
28 "includeDescendants": false,
29 "enrichDetails": true,
30 "skipNoLeads": false,
31 "maxItems": 3
32};
33
34
35const run = await client.actor("lentic_clockss/hacker-news-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