Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lighthousedataextract

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lighthousedataextract

Google LightHouse Data Extractor

  • 1.0.9
  • Source
  • PyPI
  • Socket score

Maintainers
1

LightHouse Data Extract

Python Logo

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-1Middle Tail
https://www.example.com/products/product-1234Long 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_report = report.df_report()
df_report.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)

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc