Skip to content

Instantly share code, notes, and snippets.

@wy
Created March 27, 2019 23:33
Show Gist options
  • Save wy/56b4d0d2f47b6f4cdeadb59b8cb0ab7f to your computer and use it in GitHub Desktop.
Save wy/56b4d0d2f47b6f4cdeadb59b8cb0ab7f to your computer and use it in GitHub Desktop.
lazyload bash lookfantastic
#!/bin/bash
for i in {1..1000};
do
sudo lighthouse https://www.lookfantastic.com --extra-headers='{"x-thehutsrv":"227"}' --chrome-flags="--headless --no-sandbox" --output=json --output-path=test.json --quiet
speedindex=$(cat test.json | jq '.["audits"]' | jq '.["speed-index"]' | jq '.["rawValue"]')
totalbyteweight=$(cat test.json | jq '.["audits"]' | jq '.["total-byte-weight"]' | jq '.["rawValue"]')
interactive=$(cat test.json | jq '.["audits"]' | jq '.["interactive"]' | jq '.["rawValue"]')
printf '%s\n' $speedindex $totalbyteweight $interactive | paste -sd ',' >> lookfantastic.csv
printf '%s,' "normal" $speedindex $totalbyteweight $interactive
printf '\n'
sudo lighthouse https://www.lookfantastic.com?hasLazyLoadingImages=true --extra-headers='{"x-thehutsrv":"227"}' --chrome-flags="--headless --no-sandbox" --output=json --output-path=test.json --quiet
speedindex=$(cat test.json | jq '.["audits"]' | jq '.["speed-index"]' | jq '.["rawValue"]')
totalbyteweight=$(cat test.json | jq '.["audits"]' | jq '.["total-byte-weight"]' | jq '.["rawValue"]')
interactive=$(cat test.json | jq '.["audits"]' | jq '.["interactive"]' | jq '.["rawValue"]')
printf '%s\n' $speedindex $totalbyteweight $interactive | paste -sd ',' >> lookfantasticll.csv
printf '%s,' "lazy" $speedindex $totalbyteweight $interactive
printf '\n'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment