Google LightHouse Data Extractor
Project description
LightHouse Data Extract
This tool parses the google lighthouse json data, accepts a csv file for categories of the URLs and returns 4 pandas DataFrames for metrics, opportunities, diagnostics and resources.
Install
pip install lighthousedataextract
Import
from lighthousedataextract import LightHouseDataExtract
Create a report variable
If json files are in directory ./repprt/lighthouse/ and you don't want to give an input file for categories of URLs
report = LightHouseDataExtract()
If your json files are in another directory
report = LightHouseDataExtract(
path_to_json="./data/lighthouse/report/lighthouse/"
)
If you want to seperate URLs in categories
Your CSV of URLs should have two columns, without headers. Below you can see an example:
https://www.example.com/ | Home Page |
https://www.example.com/categories/category-1 | Middle Tail |
https://www.example.com/products/product-1234 | Long Tail |
report = LightHouseDataExtract(url_category_file="./data/lighthouse/category.csv")
Create a lighthouse metrics DataFrame
from lighthousedataextract import LightHouseDataExtract
report = LightHouseDataExtract(
path_to_json="./data/lighthouse/report/lighthouse/",
url_category_file="./data/lighthouse/category.csv",
)
df_lh_perf_metrics = report.df_lh_perf_metrics()
df_lh_perf_metrics.set_index("url").T
Create other DataFrames
df_opportunities = report.df_opportunities()
display(df_opportunities)
df_diagnostics = report.df_diagnostics()
display(df_diagnostics)
df_resources = report.df_resources()
display(df_resources)
If json files are obtained by gooogle pagespeed insights api then
api_report = LightHouseDataExtract(from_api=True)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for lighthousedataextract-1.0.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40170555bbc91d8ca68a39f16cfe35f5ba49bcbc171eb58b4e4e55a389c4f0a6 |
|
MD5 | b3cde1f8303425d848b8b17e69d6fd65 |
|
BLAKE2b-256 | 3e106d1f1bb9ea0f6dd28f8b4c9bfb8bf90dc490cc52b5b28ebba85981d8da3b |
Close
Hashes for lighthousedataextract-1.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47db3191c08428c6d6a62bea412e01eb9db67821cd1d4cb3d6bd4a6584c29330 |
|
MD5 | 85571b05ea1ca068b37f7bc10c4ef9dd |
|
BLAKE2b-256 | cbba803d9db19e4c65d591d9c3d958875608ff664d85ddc1f7a6a5727b68136e |