Skip to content

Commit

Permalink
abstractripper avoids endless runs by checking url is seen
Browse files Browse the repository at this point in the history
multiple bug reports were made, like RipMeApp#20, RipMeApp#1854 .
  • Loading branch information
soloturn committed Mar 28, 2021
1 parent 7f1ae26 commit cfb0366
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsoup.nodes.Document;

import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
Expand Down Expand Up @@ -104,7 +106,15 @@ public void rip() throws IOException {
LOGGER.debug("Adding items from " + this.url + " to queue");
}

List<String> doclocation = new ArrayList<>();
while (doc != null) {

// catch if we saw a doc location already, save the ones seen in a list
if (doclocation.contains(doc.location())) {
break;
}
doclocation.add(doc.location());

if (alreadyDownloadedUrls >= Utils.getConfigInteger("history.end_rip_after_already_seen", 1000000000) && !isThisATest()) {
sendUpdate(STATUS.DOWNLOAD_COMPLETE_HISTORY, "Already seen the last " + alreadyDownloadedUrls + " images ending rip");
break;
Expand Down

0 comments on commit cfb0366

Please sign in to comment.