groovy screen scraping example

#!/usr/bin/env groovy
// Depends on tagsoup library:

def slurper = new XmlSlurper(new org.ccil.cowan.tagsoup.Parser())

def url = new URL("")

url.withReader { reader ->

html = slurper.parse(reader)

//we should now have a parsed file

def value = html.body.div.div.div[2]

value.list().each { f ->

println "\nPub : " << f.toString()[0..80] << "..."



[gkowalski]$ ./screenScrape.groovy
Pub : Role of cannabinoids and endocannabinoids in cerebral ischemia. (Hillard CJ) Cur…
Pub : Regional alterations in the endocannabinoid system in an animal model of depressi…
Pub : Mediation of Cannabidiol Anti-inflammation in the Retina by Equilibrative Nucleos…


One thought on “groovy screen scraping example

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s