Skip to content

Instantly share code, notes, and snippets.

@apemberton
Last active June 15, 2022 12:09
Show Gist options
  • Save apemberton/7c4c4f99d3121aeb9ea3 to your computer and use it in GitHub Desktop.
Save apemberton/7c4c4f99d3121aeb9ea3 to your computer and use it in GitHub Desktop.
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1' )
import static groovyx.net.http.Method.GET
import static groovyx.net.http.ContentType.*
def http = new groovyx.net.http.HTTPBuilder('http://stats.jenkins-ci.org/')
def plugins
http.request(GET,HTML) { req ->
uri.path = '/plugin-installation-trend/'
response.success = { resp, html ->
plugins = html.BODY.TABLE
}
}
plugins.TBODY.TR.eachWithIndex{ it, i ->
//skip header and footer rows
if( i > 2 && i < plugins.TBODY.TR.size() ){
def path = it.TD[1].A.@href
http.request(GET,JSON) { req ->
uri.path = "/plugin-installation-trend/${path}"
response.success = { resp, json ->
println "${json.name} | ${json.installations?.max{ it.key }.value}"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment