Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run Google Page speed from the command line?

Is it possible to run Google Page speed from the command line? If so, how? I'm interested in automating nightly or daily Google PageSpeed calls that will inform me after a commit or daily if I've caused a drop in the Google PageSpeed 'grade' (for a given page).

like image 493
lucidquiet Avatar asked Mar 21 '12 23:03

lucidquiet


2 Answers

It's possible to use the PageSpeed Insights from the command line:

Install via: $ npm install --global psi

Usage: $ psi <url> --key=<key> --prettyprint=<true> --userIp=<userIp> --locale=<locale> --strategy=<desktop|mobile>

Run it like this: $ psi http://stackoverflow.com

PageSpeed Desktop Insights CLI

Also for mobile insights: $ psi http://stackoverflow.com --strategy=mobile

PageSpeed Mobile Insights CLI

UPDATE: You can use the PageSpeed Insights within your local development environment (internet connection required) with grunt + grunt-pagespeed + ngrok. Checkout the sample project for grunt-pagespeed and ngrok for further information.

Note: Run $ ngrok -authtoken <your-token> 80 and check the web interface parameters to make sure to set the right port in your Gruntfile.js!

like image 116
Sven Avatar answered Sep 22 '22 05:09

Sven


There is a Google Page Speed API. It won't work directly from a command line but you can easily write a script in your language of choice that will interact with the API.

like image 39
abraham Avatar answered Sep 21 '22 05:09

abraham