1.0.38 - Rips large imagefap galleries

Closes #25
This commit is contained in:
4pr0n 2014-05-11 10:07:58 -07:00
parent 5e4df22b3c
commit 14c2d8a317
4 changed files with 40 additions and 11 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.rarchives.ripme</groupId> <groupId>com.rarchives.ripme</groupId>
<artifactId>ripme</artifactId> <artifactId>ripme</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.0.37</version> <version>1.0.38</version>
<name>ripme</name> <name>ripme</name>
<url>http://rip.rarchives.com</url> <url>http://rip.rarchives.com</url>
<properties> <properties>

View File

@ -204,6 +204,7 @@ public abstract class AlbumRipper extends AbstractRipper {
} }
connection.ignoreContentType(ignoreContentType); connection.ignoreContentType(ignoreContentType);
connection.maxBodySize(0);
Response response = null; Response response = null;
int retries = Utils.getConfigInteger("download.retries", 1);; int retries = Utils.getConfigInteger("download.retries", 1);;
while (retries >= 0) { while (retries >= 0) {

View File

@ -12,6 +12,7 @@ import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import com.rarchives.ripme.ripper.AlbumRipper; import com.rarchives.ripme.ripper.AlbumRipper;
import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
public class ImagefapRipper extends AlbumRipper { public class ImagefapRipper extends AlbumRipper {
@ -85,10 +86,15 @@ public class ImagefapRipper extends AlbumRipper {
@Override @Override
public void rip() throws IOException { public void rip() throws IOException {
int index = 0; int index = 0;
sendUpdate(STATUS.LOADING_RESOURCE, this.url.toExternalForm());
logger.info(" Retrieving " + this.url.toExternalForm()); logger.info(" Retrieving " + this.url.toExternalForm());
if (albumDoc == null) { if (albumDoc == null) {
albumDoc = Jsoup.connect(this.url.toExternalForm()).get(); albumDoc = Jsoup.connect(this.url.toExternalForm()).get();
} }
while (true) {
if (isStopped()) {
break;
}
for (Element thumb : albumDoc.select("#gallery img")) { for (Element thumb : albumDoc.select("#gallery img")) {
if (!thumb.hasAttr("src") || !thumb.hasAttr("width")) { if (!thumb.hasAttr("src") || !thumb.hasAttr("width")) {
continue; continue;
@ -100,6 +106,28 @@ public class ImagefapRipper extends AlbumRipper {
index += 1; index += 1;
addURLToDownload(new URL(image), String.format("%03d_", index)); addURLToDownload(new URL(image), String.format("%03d_", index));
} }
String nextURL = null;
for (Element a : albumDoc.select("a.link3")) {
if (a.text().contains("next")) {
nextURL = a.attr("href");
nextURL = "http://imagefap.com/gallery.php" + nextURL;
break;
}
}
if (nextURL == null) {
break;
}
else {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
logger.error("Interrupted while waiting to load next page", e);
throw new IOException(e);
}
sendUpdate(STATUS.LOADING_RESOURCE, this.url.toExternalForm());
albumDoc = Jsoup.connect(nextURL).get();
}
}
waitForThreads(); waitForThreads();
} }

View File

@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils;
public class UpdateUtils { public class UpdateUtils {
private static final Logger logger = Logger.getLogger(UpdateUtils.class); private static final Logger logger = Logger.getLogger(UpdateUtils.class);
private static final String DEFAULT_VERSION = "1.0.37"; private static final String DEFAULT_VERSION = "1.0.38";
private static final String updateJsonURL = "http://rarchives.com/ripme.json"; private static final String updateJsonURL = "http://rarchives.com/ripme.json";
private static final String updateJarURL = "http://rarchives.com/ripme.jar"; private static final String updateJarURL = "http://rarchives.com/ripme.jar";
private static final String mainFileName = "ripme.jar"; private static final String mainFileName = "ripme.jar";