Skip to content

Instantly share code, notes, and snippets.

@tango238
Created May 5, 2012 06:57
Show Gist options
  • Save tango238/2600528 to your computer and use it in GitHub Desktop.
Save tango238/2600528 to your computer and use it in GitHub Desktop.
Download image files from Chrome's Developer tools "Save All as HAR".
import groovy.json.*
def slurper = new JsonSlurper()
def text = new File('hoge.com.har').text
def root = slurper.parseText(text)
def getImage(address){
def command = 'wget ' + address
def proc = command.execute()
proc.waitFor()
}
def entries = root.log.entries
entries.each {
def orgurl = it.request.url
def url = orgurl.toLowerCase()
if(url.endsWith('jpg') || url.endsWith('jpeg') || url.endsWith('png')){
try{
getImage(orgurl)
}catch(Exception e){
println e
}
}
}
@shankarbhai
Copy link

how to use this

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