1.0.55 - Ehentai ripper bypasses content warning

Closes #57
This commit is contained in:
4pr0n 2014-06-07 01:05:30 -07:00
parent 574b03e45e
commit 6c90522693
3 changed files with 23 additions and 3 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.54</version> <version>1.0.55</version>
<name>ripme</name> <name>ripme</name>
<url>http://rip.rarchives.com</url> <url>http://rip.rarchives.com</url>
<properties> <properties>

View File

@ -43,7 +43,17 @@ public class EHentaiRipper extends AlbumRipper {
} }
public URL sanitizeURL(URL url) throws MalformedURLException { public URL sanitizeURL(URL url) throws MalformedURLException {
return url; String u = url.toExternalForm();
if (u.contains("nw=session")) {
return url;
}
else if (u.contains("?")) {
u += "&nw=session";
}
else {
u += "?nw=session";
}
return new URL(u);
} }
public String getAlbumTitle(URL url) throws MalformedURLException { public String getAlbumTitle(URL url) throws MalformedURLException {
@ -88,6 +98,9 @@ public class EHentaiRipper extends AlbumRipper {
int index = 0, retries = 3; int index = 0, retries = 3;
String nextUrl = this.url.toExternalForm(); String nextUrl = this.url.toExternalForm();
while (true) { while (true) {
if (isStopped()) {
break;
}
if (albumDoc == null) { if (albumDoc == null) {
logger.info(" Retrieving album page " + nextUrl); logger.info(" Retrieving album page " + nextUrl);
sendUpdate(STATUS.LOADING_RESOURCE, nextUrl); sendUpdate(STATUS.LOADING_RESOURCE, nextUrl);
@ -123,6 +136,9 @@ public class EHentaiRipper extends AlbumRipper {
} }
// Iterate over images on page // Iterate over images on page
for (Element thumb : thumbs) { for (Element thumb : thumbs) {
if (isStopped()) {
break;
}
index++; index++;
EHentaiImageThread t = new EHentaiImageThread(new URL(thumb.attr("href")), index, this.workingDir); EHentaiImageThread t = new EHentaiImageThread(new URL(thumb.attr("href")), index, this.workingDir);
ehentaiThreadPool.addThread(t); ehentaiThreadPool.addThread(t);
@ -132,6 +148,10 @@ public class EHentaiRipper extends AlbumRipper {
logger.warn("Interrupted while waiting to load next image", e); logger.warn("Interrupted while waiting to load next image", e);
} }
} }
if (isStopped()) {
break;
}
// Find next page // Find next page
Elements hrefs = albumDoc.select(".ptt a"); Elements hrefs = albumDoc.select(".ptt a");
if (hrefs.size() == 0) { if (hrefs.size() == 0) {

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.54"; private static final String DEFAULT_VERSION = "1.0.55";
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";