Created
April 26, 2011 11:55
-
-
Save cosmin/942142 to your computer and use it in GitHub Desktop.
Extract images, css and js from a HAR archive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import json | |
def process(filename): | |
inp = open(filename, 'r') | |
data = json.load(inp) | |
inp.close() | |
entries = [x['request']['url'] for x in data['log']['entries']] | |
csses = [el for el in entries if el.endswith('css')] | |
images = [el for el in entries if el.endswith('png') or el.endswith('gif')] | |
for image in images: | |
print "I", image | |
print "" | |
for css in csses: | |
print "C", css | |
if __name__ == "__main__": | |
process(sys.argv[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment