在 PageSpeed Insights API v5 的 json 结果中查找分数 [英] Find score inside json result of PageSpeed Insights API v5

查看:76
本文介绍了在 PageSpeed Insights API v5 的 json 结果中查找分数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试 Google v5 API 页面速度洞察,但在 JSON 结果中找不到 SCORE.

I'm trying the Google v5 API page speed insight but i don't find the SCORE inside the JSON result.

这是 api https://www.googleapis.com/pagespeedonline/v5/runPagespeed

在 v4 中有一个 ruleGroups.SPEED.score 包含一个整数和分数.

In the v4 there is a ruleGroups.SPEED.score that contains an integer with the score.

在哪里可以找到 v5 中的分数?

Where i can find the score inside the v5?

推荐答案

我觉得是这样的:json.lighthouseResult.categories.performance.score

I think it is the following: json.lighthouseResult.categories.performance.score

返回以 1 为最大值的小数.所以你必须乘以 100 才能得到百分比.对我有用..但是我似乎每次都没有得到相同的价值.它波动...

Returns a decimal with 1 as maximum. So you have to multiply with 100 to get the percentage. Works for me.. However I don't seem to get the same value every time. It fluctuates...

这篇关于在 PageSpeed Insights API v5 的 json 结果中查找分数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆