1
0
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:
MetaPrime
2025-01-06 02:16:54 -08:00
parent 2fe79d0881
commit adffa2261d

View File

@@ -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;
} }