mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-04-22 04:32:06 +02:00
Add Next Page Functionality
This commit is contained in:
parent
31c71f4484
commit
2ace43b5ae
@ -1,6 +1,7 @@
|
||||
package com.rarchives.ripme.ripper.rippers;
|
||||
|
||||
import com.rarchives.ripme.ripper.AbstractJSONRipper;
|
||||
import com.rarchives.ripme.ripper.rippers.ArtStationRipper.URL_TYPE;
|
||||
import com.rarchives.ripme.utils.Http;
|
||||
import com.rarchives.ripme.utils.Utils;
|
||||
|
||||
@ -12,6 +13,8 @@ import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -37,6 +40,9 @@ public class CoomerPartyRipper extends AbstractJSONRipper {
|
||||
private static final String KEY_PATH = "path";
|
||||
private static final String KEY_ATTACHMENTS = "attachments";
|
||||
|
||||
private Integer pageCount = 0;
|
||||
|
||||
|
||||
// One of "onlyfans" or "fansly", but might have others in future?
|
||||
private final String service;
|
||||
|
||||
@ -95,6 +101,24 @@ public class CoomerPartyRipper extends AbstractJSONRipper {
|
||||
return wrapperObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JSONObject getNextPage(JSONObject doc) throws IOException, URISyntaxException {
|
||||
pageCount = pageCount + 1;
|
||||
Integer offset = 50 * pageCount;
|
||||
String apiUrl = String.format("https://coomer.su/api/v1/%s/user/%s?o=%d", service, user, offset);
|
||||
String jsonArrayString = Http.url(apiUrl)
|
||||
.ignoreContentType()
|
||||
.response()
|
||||
.body();
|
||||
JSONArray jsonArray = new JSONArray(jsonArrayString);
|
||||
|
||||
// Ideally we'd just return the JSONArray from here, but we have to wrap it in a JSONObject
|
||||
JSONObject wrapperObject = new JSONObject();
|
||||
wrapperObject.put(KEY_WRAPPER_JSON_ARRAY, jsonArray);
|
||||
return wrapperObject;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected List<String> getURLsFromJSON(JSONObject json) {
|
||||
// extract the array from our wrapper JSONObject
|
||||
|
Loading…
x
Reference in New Issue
Block a user