我試圖在我的應用程序中包含Google PageSpeed Insights
得分。我碰到的API來爲它並嘗試使用它:Google PageSpeed Score Calculation
https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url=http://wikipedia.org&filter_third_party_resources=true&locale=en_US&screenshot=false&strategy=desktop&key=MyAPIKey
這個我得到的輸出後,如圖要點:
https://gist.github.com/JafferWilson/6f8c5661e11654f301247edca45d23df
但是當我使用PageSpeed Insights的應用,具有相同的域名爲:WikiPedia.org
,我得到了不同的得分結果,在JSON API中找不到:https://developers.google.com/speed/pagespeed/insights/?url=http%3A%2F%2Fwikipedia.org&tab=mobile
我在Python10.7中使用了windows10。並試圖將此代碼用於訪問API:
>>> url = "https://www.googleapis.com/pagespeedonline/v2/runPagespeed?url=http://wikipedia.org&filter_third_party_resources=true&locale=en_US&screenshot=false&strategy=desktop&key=MYAPIKey"
>>> response = urllib.urlopen(url)
>>> data = json.loads(response.read())
print data.
但我想有確切的得分在谷歌的PageSpeedInsights如圖所示。請向我建議與Google Insights Page具有相同分數的方式。無論如何,我無法在API結果中看到相同的分數。
你能說清楚你在找什麼嗎?頁面得分(87)在你的json中是正確的。 –
當然讓我告訴你。你現在看到的輸出是一樣的。但對於不同的網址,我會得到不同的結果,並給出桌面結果,而不是移動設備。我如何計算準確度。 –
準確度是什麼意思? –