Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marcelmaatkamp/378548 to your computer and use it in GitHub Desktop.
Save marcelmaatkamp/378548 to your computer and use it in GitHub Desktop.
#!/usr/bin/env groovy
import groovyx.net.http.*
import static groovyx.net.http.Method.GET
import static groovyx.net.http.ContentType.HTML
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.0-SNAPSHOT' )
def http = new HTTPBuilder( 'https://www.google.com' )
http.request( GET, HTML ) { req ->
uri.path = "/"
response.success = { resp, page ->
def properties = new Properties()
properties.load(
new ByteArrayInputStream(
page.HEAD.SCRIPT.text().replace(',','').replace('"','').getBytes()
)
)
println "properties: "+properties
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment