1
1
Fork
You've already forked check-page-speed
0
Generate PageSpeed Insights reports for web pages
  • Go 100%
2026年07月09日 20:06:19 +09:00
build Add build/test.yaml. 2022年08月18日 10:19:40 -04:00
go.mod Use Go 1.25.12 and golang.org/x/net@v0.55.0 for govulncheck. 2026年07月09日 20:06:19 +09:00
go.sum Use Go 1.25.12 and golang.org/x/net@v0.55.0 for govulncheck. 2026年07月09日 20:06:19 +09:00
LICENSE Add placeholder README.md and LICENSE. 2022年08月16日 21:20:21 -04:00
mail.go Move to codeberg.org. 2023年04月15日 20:06:29 -04:00
main.go Add -pwa flag. 2022年08月18日 13:27:50 -04:00
README.md Fix build status URLs in README.md. [skip ci] 2024年06月07日 19:26:23 +08:00
report.go Handle maps with "value" keys, e.g. for Total DOM Elements. 2024年07月06日 10:09:42 -04:00
strutil.go Delete an unused constant. 2026年05月08日 17:34:44 -06:00
strutil_test.go Refactor to report.go and add -audits and -details. 2022年08月16日 21:18:48 -04:00
table.go Add formatTable tests. 2022年08月17日 09:07:58 -04:00
table_test.go Add formatTable tests. 2022年08月17日 09:07:58 -04:00
text.go Fix an (I think) errant period in text reports. 2024年07月06日 10:09:20 -04:00

check-page-speed

Build Status

check-page-speed is a command-line program that uses Google's free PageSpeed Insights API to generate Lighthouse reports about one or more web pages, optionally sending them via email. Its main purpose is automated monitoring of a website's performance, accessibility, adherence to best practices, SEO, and PWA support.

Usage

To compile and install the check-page-speed executable, run go install from the root of this repository. You will need to have Go installed.

The program accepts flags to control its behaior followed by one or more URLs to analyze:

Usage: check-page-speed [flag]... <url>...
Analyzes web pages using PageSpeed Insights.
 -audits string
 Audits to print ("failed", "all", "none") (default "failed")
 -detail-width int
 Maximum audit detail column width (-1 for no limit) (default 40)
 -details int
 Maximum details for each audit (-1 for all) (default 10)
 -full-urls
 Print full URLs (instead of paths) in report
 -key string
 API key to use (can also set PAGE_SPEED_API_KEY)
 -mail string
 Email address to mail report to (write report to stdout if empty)
 -mobile
 Analyzes the page as a mobile (rather than desktop) device
 -pwa
 Perform Progressive Web App audits (default true)
 -retries int
 Maximum retries after failed calls to API (default 2)
 -verbose
 Log verbosely
 -workers int
 Maximum simultaneous calls to API (default 8)

By default, check-page-speed prints a summary with each URL's score in the Performance, Accessibility, Best Practices, Search Engine Optimization, and Progressive Web App Lighthouse categories, followed by lengthier reports listing the failed (non-100) audits for each URL:

$ check-page-speed https://web.dev/ https://web.dev/about/ https://web.dev/blog/
URL Perf A11Y Best SEO PWA
/ 100 97 100 83 89
/about/ 100 100 100 83 89
/blog/ 99 91 100 92 89
================================================================================
https://web.dev/
100 Performance
--------------------
 99 Largest Contentful Paint
 89 Reduce unused CSS
 URL Transfer Size Potential Savings
 https://www.gstatic.com/recaptch...ltr.css 25173 25160
 https://web.dev/css/next.css?v=b56043e5 20381 15157
 74 Reduce unused JavaScript
 URL Transfer Size Potential Savings
 https://www.gstatic.com/recaptch...__en.js 158237 93490
 https://web.dev/js/index-8b0d1eca.js 89791 74601
...

If the -mail flag is used to supply an address, check-page-speed will instead email the summary with attached full reports via a local SMTP server at localhost:25.

The PageSpeed Insights API frequently fails when called anonymously, so you probably want to create an API key and pass it via the -key flag or the PAGE_SPEED_API_KEY environment variable. As of mid-2022, the API appears to still be free.