Skip to content

Commit

Permalink
new URI instead of new URL, abstractjsonripper nextPage.
Browse files Browse the repository at this point in the history
  • Loading branch information
soloturn committed Nov 18, 2023
1 parent 4b9a4f1 commit d59de51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected AbstractJSONRipper(URL url) throws IOException {
public abstract String getHost();

protected abstract JSONObject getFirstPage() throws IOException;
protected JSONObject getNextPage(JSONObject doc) throws IOException {
protected JSONObject getNextPage(JSONObject doc) throws IOException, URISyntaxException {
throw new IOException("getNextPage not implemented");
}
protected abstract List<String> getURLsFromJSON(JSONObject json);
Expand Down Expand Up @@ -104,7 +104,7 @@ public void rip() throws IOException {
try {
sendUpdate(STATUS.LOADING_RESOURCE, "next page");
json = getNextPage(json);
} catch (IOException e) {
} catch (IOException | URISyntaxException e) {
LOGGER.info("Can't get next page: " + e.getMessage());
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ public JSONObject getFirstPage() throws IOException {
}

@Override
public JSONObject getNextPage(JSONObject doc) throws IOException {
public JSONObject getNextPage(JSONObject doc) throws IOException, URISyntaxException {
currPage++;
String u = currUrl.toExternalForm() + "&page=" + Integer.toString(currPage);
JSONObject json = Http.url(new URL(u)).getJSON();
JSONObject json = Http.url(new URI(u).toURL()).getJSON();
JSONArray arr;
if (json.has("images")) {
arr = json.getJSONArray("images");
Expand Down

0 comments on commit d59de51

Please sign in to comment.