Closed AzureAaron closed 3 years ago
I'm not quite sure what you mean, the endpoint seems to be working as expected. I wrote a small bit of code and the output is as expected
String url = "https://api.hypixel.net/skyblock/auctions";
JSONObject body = Unirest.get(url).asJson().getBody().getObject();
int totalPages = body.getInt("totalPages");
int totalAuctions = body.getInt("totalAuctions");
Set<String> auctionsFound = new HashSet<>();
for (int i = 0; i < totalPages; i++) {
JSONArray auctions = Unirest.get(url + "?page=" + i).asJson().getBody().getObject().getJSONArray("auctions");
for (Object auction : auctions) {
auctionsFound.add(((JSONObject) auction).getString("uuid"));
}
}
System.out.printf("Found %d auctions with an expected count of %d%n", auctionsFound.size(), totalAuctions);
Output:
Found 73389 auctions with an expected count of 73389
I'm not quite sure what you mean, the endpoint seems to be working as expected. I wrote a small bit of code and the output is as expected
String url = "https://api.hypixel.net/skyblock/auctions"; JSONObject body = Unirest.get(url).asJson().getBody().getObject(); int totalPages = body.getInt("totalPages"); int totalAuctions = body.getInt("totalAuctions"); Set<String> auctionsFound = new HashSet<>(); for (int i = 0; i < totalPages; i++) { JSONArray auctions = Unirest.get(url + "?page=" + i).asJson().getBody().getObject().getJSONArray("auctions"); for (Object auction : auctions) { auctionsFound.add(((JSONObject) auction).getString("uuid")); } } System.out.printf("Found %d auctions with an expected count of %d%n", auctionsFound.size(), totalAuctions);
Output:
Found 73389 auctions with an expected count of 73389
Ah I see, appears I had confused myself with something.
Lets say there was 86,789 active auctions with 87 pages. You can only fetch 85,789 of those because the last page is not fetchable; plus the second-last page has the number of auctions which should be on last page.
I'd be great if this was fixed, thanks!