Last active
June 15, 2022 12:09
-
-
Save apemberton/7c4c4f99d3121aeb9ea3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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