1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-01-16 20:28:15 +01: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
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));
}
@ -179,6 +181,9 @@ public class RedgifsRipper extends AbstractJSONRipper {
@Override
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()) {
return null;
}