Skip to content

Instantly share code, notes, and snippets.

@ledlogic
Created February 27, 2016 00:47
Show Gist options
  • Save ledlogic/761a3c1e5e7723a9c08d to your computer and use it in GitHub Desktop.
Save ledlogic/761a3c1e5e7723a9c08d to your computer and use it in GitHub Desktop.
Extract urls from har file to csv (text) file.
#!/usr/bin/ruby
require 'rubygems'
require 'json'
require 'csv'
infile = ARGV[0]
json = File.read(infile)
parsed = JSON.parse(json.encode("UTF-8"))
outfile = ARGV[1]
CSV.open(outfile, "wb") do |csv|
parsed["log"]["entries"].each do |entry|
csv << [entry["request"]["url"]]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment