1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-14 01:44:12 +02:00

RedditRipper.java - special support to add rate limiting for redgifs.com links

This commit is contained in:
MetaPrime
2025-01-06 04:02:31 -08:00
parent 2dfb627e36
commit eab411fac8

View File

@@ -419,8 +419,7 @@ public class RedditRipper extends AlbumRipper {
String savePath = this.workingDir + "/"; String savePath = this.workingDir + "/";
savePath += id + "-" + m.group(1) + Utils.filesystemSafe(title) + ".jpg"; savePath += id + "-" + m.group(1) + Utils.filesystemSafe(title) + ".jpg";
addURLToDownload(urls.get(0), Utils.getPath(savePath)); addURLToDownload(urls.get(0), Utils.getPath(savePath));
} } else if (url.contains("v.redd.it")) {
if (url.contains("v.redd.it")) {
String savePath = this.workingDir + "/"; String savePath = this.workingDir + "/";
savePath += id + "-" + url.split("/")[3] + Utils.filesystemSafe(title) + ".mp4"; savePath += id + "-" + url.split("/")[3] + Utils.filesystemSafe(title) + ".mp4";
URL urlToDownload = parseRedditVideoMPD(urls.get(0).toExternalForm()); URL urlToDownload = parseRedditVideoMPD(urls.get(0).toExternalForm());
@@ -428,8 +427,12 @@ public class RedditRipper extends AlbumRipper {
LOGGER.info("url: " + urlToDownload + " file: " + savePath); LOGGER.info("url: " + urlToDownload + " file: " + savePath);
addURLToDownload(urlToDownload, Utils.getPath(savePath)); addURLToDownload(urlToDownload, Utils.getPath(savePath));
} }
} } else {
else { if (url.contains("redgifs.com")) {
// redgifs.com rate limits us if we download too fast,
// and redgifs.com is a pretty common link on Reddit.
sleep(3000);
}
addURLToDownload(urls.get(0), Utils.filesystemSafe(id + title), "", theUrl, null); addURLToDownload(urls.get(0), Utils.filesystemSafe(id + title), "", theUrl, null);
} }
} else if (urls.size() > 1) { } else if (urls.size() > 1) {