Skip to content

Commit

Permalink
Updated RippleServer to v2 API.
Browse files Browse the repository at this point in the history
  • Loading branch information
itdelatrisu committed Oct 16, 2017
1 parent 959d185 commit 6a3c6f7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/itdelatrisu/opsu/downloads/servers/RippleServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class RippleServer extends DownloadServer {
private static final String SERVER_NAME = "Ripple";

/** Formatted download URL: {@code beatmapSetID} */
private static final String DOWNLOAD_URL = "https://storage.ripple.moe/%d.osz";
private static final String DOWNLOAD_URL = "https://storage.ripple.moe/d/%d";

/** Formatted search URL: {@code query,amount,offset} */
private static final String SEARCH_URL = "https://storage.ripple.moe/api/search?query=%s&mode=0&amount=%d&offset=%d";
Expand Down Expand Up @@ -81,14 +81,13 @@ public DownloadNode[] resultList(String query, int page, boolean rankedOnly) thr
String search = String.format(SEARCH_URL, URLEncoder.encode(query, "UTF-8"), PAGE_LIMIT, offset);
if (rankedOnly)
search += "&status=1";
JSONObject json = Utils.readJsonObjectFromUrl(new URL(search));
if (json == null || !json.has("Ok") || !json.getBoolean("Ok") || !json.has("Sets") || json.isNull("Sets")) {
JSONArray arr = Utils.readJsonArrayFromUrl(new URL(search));
if (arr == null) {
this.totalResults = -1;
return null;
}

// parse result list
JSONArray arr = json.getJSONArray("Sets");
nodes = new DownloadNode[arr.length()];
for (int i = 0; i < nodes.length; i++) {
JSONObject item = arr.getJSONObject(i);
Expand Down

0 comments on commit 6a3c6f7

Please sign in to comment.