mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-08 14:56:38 +02:00
new URI instead of new URL, abstractjsonripper nextPage.
This commit is contained in:
@@ -38,7 +38,7 @@ public abstract class AbstractJSONRipper extends AbstractRipper {
|
||||
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);
|
||||
@@ -104,7 +104,7 @@ public abstract class AbstractJSONRipper extends AbstractRipper {
|
||||
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;
|
||||
}
|
||||
|
@@ -101,10 +101,10 @@ public class DerpiRipper extends AbstractJSONRipper {
|
||||
}
|
||||
|
||||
@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");
|
||||
|
Reference in New Issue
Block a user