Pagespeed API Lighthouse viewer.<!-- --> | <!-- -->IORoot
logo
IORoot
Lighthouse
lighthouse

Lighthouse-viewer

Pagespeed Insights API JSON to Lighthouse-viewer.

1. Table of Contents

2. About The Project

2.1. The problem

When using the the Pagespeed Insights API you will receive back a JSON response with all of your results. This is great for parsing and using for various other things, but lacks the ability to render as an HTML file without coding it yourself.

Since the result object is actually using the lighthouse API to obtain the results, you can use the Lighthouse-viewer to render the output of the JSON file.

The slight caveat is that the viewer requires you to either paste in the results, a URL to a GIST with the results, or manually specify a file through the file-upload GUI. There is no ability to specify a file to read and opene the report automatically.

That's what this custom version of the viewer does. This is a clone of the gh-pages branch of the lighthouse git repo with a little custom JS that allows you to specify a file to open through a URL parameter.

(back to top)

2.2. Built With

This project was built with the following frameworks, technologies and software.

(back to top)

2.3. Installation

Clone this repository into a webserver directory that you can access from Apache, NGINX, etc.. e.g. /var/www/html/viewer. You should be able to see the viewer at http://mydomain.com/viewer/ or wherever you have placed the directory.

git clone https://github.com/IORoot/pagespeed-insights__lighthouse-viewer.git

(back to top)

3. Usage

  1. Obtain a JSON result object from pagespeed insights API and write to a JSON file. e.g. example_com.json and put it somewhere in the web directory you installed the viewer. e.g. /var/www/html/viewer/results.
  2. Access the viewer with the URL parameter http://mydomain.com/viewer?file=results/example_com.json and it should load the file.

4. Customising

None.

5. Troubleshooting

None

(back to top)

6. Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue. Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

7. License

Distributed under the MIT License.

MIT License

Copyright (c) 2022 Andy Pearson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

(back to top)

8. Contact

Author Link: https://github.com/IORoot

(back to top)

9. Changelog

v1.0.0 - First version.