1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "items": [
12 {
13 "input": "https://www.bbc.com/",
14 "sourceUrl": "https://www.googleapis.com/pagespeedonline/v5/runPagespeed",
15 "found": true,
16 "status": "ok",
17 "resultCount": 1,
18 "partial": false,
19 "error": "",
20 "warnings": [],
21 "checkedAt": "2026-09-23T05:03:23.591Z",
22 "schemaVersion": "1.0",
23 "url": "https://www.bbc.com/",
24 "strategy": "mobile",
25 "finalUrl": "https://www.bbc.com/",
26 "performanceScore": 0.56,
27 "LCP": 7170.740664599693,
28 "CLS": 0.11022084164631413,
29 "TBT": 315,
30 "FCP": 3021.000657027039,
31 "SI": 6007.5946841464975,
32 "metricSource": "lab",
33 "metricUnits": {
34 "LCP": "ms",
35 "CLS": "unitless",
36 "TBT": "ms",
37 "FCP": "ms",
38 "SI": "ms"
39 },
40 "fetchTime": "2026-09-23T05:03:03.710Z",
41 "lighthouseVersion": "13.5.0",
42 "topOpportunities": [
43 {
44 "id": "bootup-time",
45 "title": "Reduce JavaScript execution time",
46 "description": "Consider reducing the time spent parsing, compiling, and executing JS. You may find delivering smaller JS payloads helps with this. [Learn how to reduce Javascript execution time](https://developer.chrome.com/docs/lighthouse/performance/bootup-time/).",
47 "displayValue": "1.5 s",
48 "estimatedSavingsMs": 550,
49 "estimatedSavingsBytes": 0,
50 "metricSavings": {
51 "TBT": 550
52 }
53 },
54 {
55 "id": "unused-javascript",
56 "title": "Reduce unused JavaScript",
57 "description": "Reduce unused JavaScript and defer loading scripts until they are required to decrease bytes consumed by network activity. [Learn how to reduce unused JavaScript](https://developer.chrome.com/docs/lighthouse/performance/unused-javascript/).",
58 "displayValue": "Est savings of 494 KiB",
59 "estimatedSavingsMs": 450,
60 "estimatedSavingsBytes": 505401,
61 "metricSavings": {
62 "LCP": 450,
63 "FCP": 0
64 }
65 },
66 {
67 "id": "cache-insight",
68 "title": "Use efficient cache lifetimes",
69 "description": "A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).",
70 "displayValue": "Est savings of 664 KiB",
71 "estimatedSavingsMs": 450,
72 "estimatedSavingsBytes": 0,
73 "metricSavings": {
74 "LCP": 450,
75 "FCP": 0
76 }
77 },
78 {
79 "id": "mainthread-work-breakdown",
80 "title": "Minimize main-thread work",
81 "description": "Consider reducing the time spent parsing, compiling and executing JS. You may find delivering smaller JS payloads helps with this. [Learn how to minimize main-thread work](https://developer.chrome.com/docs/lighthouse/performance/mainthread-work-breakdown/)",
82 "displayValue": "2.4 s",
83 "estimatedSavingsMs": 300,
84 "estimatedSavingsBytes": 0,
85 "metricSavings": {
86 "TBT": 300
87 }
88 },
89 {
90 "id": "font-display-insight",
91 "title": "Font display",
92 "description": "Consider setting [`font-display`](https://developer.chrome.com/docs/performance/insights/font-display) to `swap` or `optional` to ensure text is consistently visible. `swap` can be further optimized to mitigate layout shifts with [font metric overrides](https://developer.chrome.com/blog/font-fallbacks).",
93 "displayValue": "Est savings of 50 ms",
94 "estimatedSavingsMs": 50,
95 "estimatedSavingsBytes": 0,
96 "metricSavings": {
97 "FCP": 50,
98 "INP": 0
99 }
100 }
101 ],
102 "categoryScores": {
103 "performance": 0.56
104 }
105 }
106 ]
107};
108
109
110const run = await client.actor("zinin/pagespeed-remediation-backlog").call(input);
111
112
113console.log('Results from dataset');
114console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
115const { items } = await client.dataset(run.defaultDatasetId).listItems();
116items.forEach((item) => {
117 console.dir(item);
118});
119
120