Pagespeed Insights API JSON to Lighthouse-viewer.
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.
This project was built with the following frameworks, technologies and software.
Clone this repository into a webserver directory that you can access from Apache, NGINX, etc.. e.g.
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
- Obtain a JSON result object from pagespeed insights API and write to a JSON file. e.g.
example_com.jsonand put it somewhere in the web directory you installed the viewer. e.g.
- Access the viewer with the URL parameter
http://mydomain.com/viewer?file=results/example_com.jsonand it should load the file.
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature)
- Commit your Changes (
git commit -m 'Add some AmazingFeature')
- Push to the Branch (
git push origin feature/AmazingFeature)
- Open a Pull Request
Distributed under the 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.
Author Link: https://github.com/IORoot
v1.0.0 - First version.