Skip to content

Instantly share code, notes, and snippets.

@jamesramsay
Last active June 10, 2017 23:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesramsay/b76d6ece0658647df5cd to your computer and use it in GitHub Desktop.
Save jamesramsay/b76d6ece0658647df5cd to your computer and use it in GitHub Desktop.
HAR analysis

Analysis of editorial vs advertising content

Methodology:

  • Access mobile site using Chrome device debugging tools
  • Record network activity
  • Save as HAR
  • Clean recording

Clean Recording

Using jq (brew install jq):

cat mobile.nytimes.com.20151006.har | \
jq '.log.entries | map( [.startedDateTime, .time, .request.url, .response.content.mimeType, .response.content.size, (.response.content.size - (.response.content.compression // 0)) ] | @tsv ) | .[]' > mobile.nytimes.com.20151006.tsv

V2:


cat mobile.nytimes.com.har | \
jq '.log.entries | map( [.startedDateTime, .time, .request.url, .response.content.mimeType, .response.content.size, (.response.content.size - (.response.content.compression // 0)), .response._transferSize, .response.status, .response.statusText ] ) | .[] | @csv' -r >> mobile.nytimes.com.csv

``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment