public PageRevision getMostRecentRevision ( String ... titles ) throws Exception { URL url = new URL ( entryPoint + "/w/api.php?format=json&action=query&prop=revisions&rvprop=user|timestamp&titles=" + encode ( Joiner . on ( "|" ) . join ( titles ) , "UTF-8" ) ) ; String response = readURL ( url ) ; List < PageRevision > revisions = extractRevisions ( response ) ; Collections . sort ( revisions , new Comparator < PageRevision > ( ) { @ Override public int compare ( final PageRevision o1 , final PageRevision o2 ) { return o2 . date . compareTo ( o1 . date ) ; } } ) ; return revisions . get ( 0 ) ; }
Returns the latest revision of the page which was edited last