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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
@@ -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");
|
||||||
|
Reference in New Issue
Block a user