pagespeed - 以自动方式获得整体灯塔分数
问题描述
我正在尝试自动获取许多不同页面的分数。但是 api 似乎并没有像网页版那样提供总分。
我试过使用 Lighthouse API v5 和 v4,似乎都没有得分,我可能错过了。我通过在 pagespeed 洞察网站上使用 puppeteer 让它工作,但它已经停止工作,并且想检查我没有错过任何东西,然后再尝试再次修复它
解决方案
返回的 JSON 在lighthouseResult
名为的部分下有一个部分categories
。
你categories
会看到performance
里面score
有一个孩子,得分为 1 分(所以 89 的分数是 0.89)。
"lighthouseResult": {
......
"categories": {
"performance": {
"id": "performance",
"title": "Performance",
"score": 1.00, <- here is the score.
"auditRefs":
......
推荐阅读
- c++ - 在不使用 A 到 D / D 到 A 转换器的情况下将数字数据转换为模拟数据
- reactjs - 通过 GRAPHQL 订阅传递数据仅在其中一个参数上给出 null
- c# - how to convert 'int' to 'objectParameter'?
- highcharts - 如何为高图表中的堆积条添加背景阴影
- azure - 链接服务的 Azure 服务主体名称
- kubernetes - Kubernetes nginx-Ingress 反向代理一些路径
- c# - HttpWebRequest - 无法发送具有此动词类型的内容主体
- python - 如何避免 Scrapy url 被重定向
- mysql - MySQL - 试图过滤掉过去当前时间的日期和时间
- azure - DATEDIFF 溢出