1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "startUrls": [
12 {
13 "url": "https://apify.com/"
14 }
15 ],
16 "maxRequests": 12,
17 "enqueueLinks": true,
18 "strategy": "same-hostname",
19 "globs": [
20 "https://apify.com/**"
21 ],
22 "linkSelector": "a[href]",
23 "captureTypes": [
24 "xhr",
25 "fetch"
26 ],
27 "maxExchangesPerPage": 300,
28 "includeResponseBodies": false,
29 "maxBodyKb": 256,
30 "quietMs": 800,
31 "quietTimeoutMs": 20000,
32 "steps": [
33 {
34 "type": "wait",
35 "ms": 1200
36 }
37 ],
38 "redactHeaders": [
39 "authorization",
40 "cookie",
41 "set-cookie"
42 ]
43};
44
45
46const run = await client.actor("bumpy_millionaire/api-surface-mapper").call(input);
47
48
49console.log('Results from dataset');
50console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
51const { items } = await client.dataset(run.defaultDatasetId).listItems();
52items.forEach((item) => {
53 console.dir(item);
54});
55
56