1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = { "items": [{
9 "input": "https://www.bbc.com/",
10 "sourceUrl": "https://www.googleapis.com/pagespeedonline/v5/runPagespeed",
11 "found": True,
12 "status": "ok",
13 "resultCount": 1,
14 "partial": False,
15 "error": "",
16 "warnings": [],
17 "checkedAt": "2026-09-23T05:03:23.591Z",
18 "schemaVersion": "1.0",
19 "url": "https://www.bbc.com/",
20 "strategy": "mobile",
21 "finalUrl": "https://www.bbc.com/",
22 "performanceScore": 0.56,
23 "LCP": 7170.740664599693,
24 "CLS": 0.11022084164631413,
25 "TBT": 315,
26 "FCP": 3021.000657027039,
27 "SI": 6007.5946841464975,
28 "metricSource": "lab",
29 "metricUnits": {
30 "LCP": "ms",
31 "CLS": "unitless",
32 "TBT": "ms",
33 "FCP": "ms",
34 "SI": "ms",
35 },
36 "fetchTime": "2026-09-23T05:03:03.710Z",
37 "lighthouseVersion": "13.5.0",
38 "topOpportunities": [
39 {
40 "id": "bootup-time",
41 "title": "Reduce JavaScript execution time",
42 "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/).",
43 "displayValue": "1.5 s",
44 "estimatedSavingsMs": 550,
45 "estimatedSavingsBytes": 0,
46 "metricSavings": { "TBT": 550 },
47 },
48 {
49 "id": "unused-javascript",
50 "title": "Reduce unused JavaScript",
51 "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/).",
52 "displayValue": "Est savings of 494 KiB",
53 "estimatedSavingsMs": 450,
54 "estimatedSavingsBytes": 505401,
55 "metricSavings": {
56 "LCP": 450,
57 "FCP": 0,
58 },
59 },
60 {
61 "id": "cache-insight",
62 "title": "Use efficient cache lifetimes",
63 "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).",
64 "displayValue": "Est savings of 664 KiB",
65 "estimatedSavingsMs": 450,
66 "estimatedSavingsBytes": 0,
67 "metricSavings": {
68 "LCP": 450,
69 "FCP": 0,
70 },
71 },
72 {
73 "id": "mainthread-work-breakdown",
74 "title": "Minimize main-thread work",
75 "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/)",
76 "displayValue": "2.4 s",
77 "estimatedSavingsMs": 300,
78 "estimatedSavingsBytes": 0,
79 "metricSavings": { "TBT": 300 },
80 },
81 {
82 "id": "font-display-insight",
83 "title": "Font display",
84 "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).",
85 "displayValue": "Est savings of 50 ms",
86 "estimatedSavingsMs": 50,
87 "estimatedSavingsBytes": 0,
88 "metricSavings": {
89 "FCP": 50,
90 "INP": 0,
91 },
92 },
93 ],
94 "categoryScores": { "performance": 0.56 },
95 }] }
96
97
98run = client.actor("zinin/pagespeed-remediation-backlog").call(run_input=run_input)
99
100
101print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
102for item in client.dataset(run.default_dataset_id).iterate_items():
103 print(item)
104
105