Skip to content

Instantly share code, notes, and snippets.

@studiomaestro
Created January 26, 2011 22:45
Show Gist options
  • Save studiomaestro/797665 to your computer and use it in GitHub Desktop.
Save studiomaestro/797665 to your computer and use it in GitHub Desktop.
@Grab(group='org.ccil.cowan.tagsoup', module='tagsoup', version='0.9.7')
def getHtml(String query) {
def parser = new XmlParser(new org.ccil.cowan.tagsoup.Parser())
parser.parse("http://mvnrepository.com/search.html?query="+query)
}
if(this.args.size() > 0){
getHtml(args[0]).body.'**'.p.grep{it.@class=="result"}.each{
println "${it.a[2].text()} ${it.a[1].text()}"
}
}else{
println "plz specify some query."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment