/** * This method takes revision ID and gives you all the links in that ID'ed page. * * @param revisionID * @return */ public Set<String> getRevisionIDLinks(String time) { String revisionID = getRevisionID(time); params = new HashMap<String, String>(); params.put("action", "parse"); params.put("format", Format.JSON.toString()); params.put("oldid", revisionID); params.put("prop", "links"); return parseJson("links", conn.response(params, POST)); }
/** * This method takes time (format YYYYMMDDHHMMSS) and gives you the revisionID of the first page * edited at that time. Once we get this revision ID we can get the links in that Page. * * @param time * @return */ public String getRevisionID(String time) { // String timeString = String.valueOf(time); params = new HashMap<String, String>(); params.put("action", "query"); params.put("titles", wikipediaPage); params.put("format", Format.JSON.toString()); params.put("prop", "revisions"); params.put("rvlimit", "1"); params.put("rvprop", "ids"); params.put("rvdir", "newer"); params.put("rvstart", time); return parseRevisionJson(conn.response(params, POST)); }
/** * initializes the parameters for every call to the connect to the API * * <p>For example: 1. to get links 2. to get text */ private static void initializeParams() { params = new HashMap<String, String>(); params.put("action", "parse"); params.put("page", wikipediaPage); params.put("format", Format.JSON.toString()); }