Added hasASAPRipping(), which if returns true allows a ripper to not return anything from getURLsFromPage()
This commit is contained in:
parent
5a21a820b3
commit
e89b27dc14
@ -53,6 +53,7 @@ public abstract class AbstractHTMLRipper extends AlbumRipper {
|
|||||||
protected boolean hasDescriptionSupport() {
|
protected boolean hasDescriptionSupport() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
public boolean hasASAPRipping() {return false;}
|
||||||
protected String[] getDescription(String url, Document page) throws IOException {
|
protected String[] getDescription(String url, Document page) throws IOException {
|
||||||
throw new IOException("getDescription not implemented"); // Do I do this or make an abstract function?
|
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();
|
Document doc = getFirstPage();
|
||||||
|
|
||||||
while (doc != null) {
|
while (doc != null) {
|
||||||
List<String> imageURLs = getURLsFromPage(doc);
|
List<String> imageURLs;
|
||||||
// Remove all but 1 image
|
if (!hasASAPRipping()) {
|
||||||
if (isThisATest()) {
|
imageURLs = getURLsFromPage(doc);
|
||||||
while (imageURLs.size() > 1) {
|
// Remove all but 1 image
|
||||||
imageURLs.remove(1);
|
if (isThisATest()) {
|
||||||
|
while (imageURLs.size() > 1) {
|
||||||
|
imageURLs.remove(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (imageURLs.size() == 0) {
|
if (imageURLs.size() == 0) {
|
||||||
throw new IOException("No images found at " + doc.location());
|
throw new IOException("No images found at " + doc.location());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String imageURL : imageURLs) {
|
for (String imageURL : imageURLs) {
|
||||||
index += 1;
|
index += 1;
|
||||||
logger.debug("Found image url #" + index + ": " + imageURL);
|
logger.debug("Found image url #" + index + ": " + imageURL);
|
||||||
downloadURL(new URL(imageURL), index);
|
downloadURL(new URL(imageURL), index);
|
||||||
if (isStopped()) {
|
if (isStopped()) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasDescriptionSupport() && Utils.getConfigBoolean("descriptions.save", false)) {
|
if (hasDescriptionSupport() && Utils.getConfigBoolean("descriptions.save", false)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user