mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-05 13:27:40 +02:00
RedgifsRipper.java - add rate limiting
This commit is contained in:
@@ -128,6 +128,8 @@ public class RedgifsRipper extends AbstractJSONRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void downloadURL(URL url, int index) {
|
public void downloadURL(URL url, int index) {
|
||||||
|
// redgifs is easy to trigger rate limit, so be a little cautious
|
||||||
|
sleep(3000);
|
||||||
addURLToDownload(url, getPrefix(index));
|
addURLToDownload(url, getPrefix(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,6 +181,9 @@ public class RedgifsRipper extends AbstractJSONRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject getNextPage(JSONObject doc) throws IOException, URISyntaxException {
|
public JSONObject getNextPage(JSONObject doc) throws IOException, URISyntaxException {
|
||||||
|
// rate limit on getting next page to not look too much like a crawler/bot
|
||||||
|
sleep(1000);
|
||||||
|
|
||||||
if (currentPage == maxPages || isSingleton().matches()) {
|
if (currentPage == maxPages || isSingleton().matches()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user