1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-08 06:46:41 +02:00

new URI instead of new URL, abstractjsonripper nextPage.

This commit is contained in:
soloturn
2023-11-18 07:01:48 +01:00
parent f54aa6f833
commit 2ece00882f
2 changed files with 4 additions and 4 deletions

View File

@@ -38,7 +38,7 @@ public abstract class AbstractJSONRipper extends AbstractRipper {
public abstract String getHost(); public abstract String getHost();
protected abstract JSONObject getFirstPage() throws IOException; 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"); throw new IOException("getNextPage not implemented");
} }
protected abstract List<String> getURLsFromJSON(JSONObject json); protected abstract List<String> getURLsFromJSON(JSONObject json);
@@ -104,7 +104,7 @@ public abstract class AbstractJSONRipper extends AbstractRipper {
try { try {
sendUpdate(STATUS.LOADING_RESOURCE, "next page"); sendUpdate(STATUS.LOADING_RESOURCE, "next page");
json = getNextPage(json); json = getNextPage(json);
} catch (IOException e) { } catch (IOException | URISyntaxException e) {
LOGGER.info("Can't get next page: " + e.getMessage()); LOGGER.info("Can't get next page: " + e.getMessage());
break; break;
} }

View File

@@ -101,10 +101,10 @@ public class DerpiRipper extends AbstractJSONRipper {
} }
@Override @Override
public JSONObject getNextPage(JSONObject doc) throws IOException { public JSONObject getNextPage(JSONObject doc) throws IOException, URISyntaxException {
currPage++; currPage++;
String u = currUrl.toExternalForm() + "&page=" + Integer.toString(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; JSONArray arr;
if (json.has("images")) { if (json.has("images")) {
arr = json.getJSONArray("images"); arr = json.getJSONArray("images");