From e89b27dc1485fb43ea19a42eb4a0ad8c78dc28a5 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Sat, 2 Dec 2017 04:49:53 -0500 Subject: [PATCH] Added hasASAPRipping(), which if returns true allows a ripper to not return anything from getURLsFromPage() --- .../ripme/ripper/AbstractHTMLRipper.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java b/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java index 3b7496a0..80bdcb34 100644 --- a/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java @@ -53,6 +53,7 @@ public abstract class AbstractHTMLRipper extends AlbumRipper { protected boolean hasDescriptionSupport() { return false; } + public boolean hasASAPRipping() {return false;} protected String[] getDescription(String url, Document page) throws IOException { throw new IOException("getDescription not implemented"); // Do I do this or make an abstract function? } @@ -68,24 +69,27 @@ public abstract class AbstractHTMLRipper extends AlbumRipper { Document doc = getFirstPage(); while (doc != null) { - List imageURLs = getURLsFromPage(doc); - // Remove all but 1 image - if (isThisATest()) { - while (imageURLs.size() > 1) { - imageURLs.remove(1); + List imageURLs; + if (!hasASAPRipping()) { + imageURLs = getURLsFromPage(doc); + // Remove all but 1 image + if (isThisATest()) { + while (imageURLs.size() > 1) { + imageURLs.remove(1); + } } - } - if (imageURLs.size() == 0) { - throw new IOException("No images found at " + doc.location()); - } + if (imageURLs.size() == 0) { + throw new IOException("No images found at " + doc.location()); + } - for (String imageURL : imageURLs) { - index += 1; - logger.debug("Found image url #" + index + ": " + imageURL); - downloadURL(new URL(imageURL), index); - if (isStopped()) { - break; + for (String imageURL : imageURLs) { + index += 1; + logger.debug("Found image url #" + index + ": " + imageURL); + downloadURL(new URL(imageURL), index); + if (isStopped()) { + break; + } } } if (hasDescriptionSupport() && Utils.getConfigBoolean("descriptions.save", false)) {