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": "http://github.com"
14 },
15 {
16 "url": "https://example.com"
17 },
18 {
19 "url": "https://example.com/this-page-does-not-exist"
20 },
21 {
22 "url": "https://www.iana.org/"
23 },
24 {
25 "url": "https://www.wikipedia.org/"
26 }
27 ],
28 "sourceMode": "urls",
29 "redirectExpectations": [],
30 "crawlDepth": 1,
31 "maxPagesToCrawl": 10,
32 "linkScope": "all",
33 "includeAssets": false,
34 "includeUrlPatterns": [],
35 "excludeUrlPatterns": [],
36 "respectRobotsTxt": true,
37 "expectedStatus": [],
38 "mustContainText": [],
39 "mustNotContainText": [],
40 "requiredHeaders": [],
41 "warnAboveRedirects": 2,
42 "slowThresholdMs": 3000,
43 "maxResponseTimeMs": 0,
44 "sslWarnDays": 30,
45 "detectSoft404": false,
46 "extractPageBasics": false,
47 "includeSecurityHeaders": false,
48 "includeResponseHeaders": false,
49 "probeHttp2": false,
50 "maxItems": 10,
51 "outputFilter": "all",
52 "trackHistory": true,
53 "monitorScope": "default",
54 "responseRegressionPercent": 100,
55 "confirmChanges": true,
56 "requestMethod": "HEAD_FALLBACK",
57 "followRedirects": true,
58 "maxRedirects": 10,
59 "timeoutSecs": 20,
60 "retries": 1,
61 "userAgentType": "monitor",
62 "userAgent": "",
63 "customHeaders": [],
64 "maxConcurrency": 10,
65 "maxConcurrencyPerHost": 2,
66 "delayPerHostMs": 250,
67 "proxyConfiguration": {
68 "useApifyProxy": false
69 }
70};
71
72
73const run = await client.actor("getascraper/http-status-intelligence-monitor").call(input);
74
75
76console.log('Results from dataset');
77console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
78const { items } = await client.dataset(run.defaultDatasetId).listItems();
79items.forEach((item) => {
80 console.dir(item);
81});
82
83