From 6c9052269341eaf2af8960e880c9fa2e578bed9c Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Sat, 7 Jun 2014 01:05:30 -0700 Subject: [PATCH] 1.0.55 - Ehentai ripper bypasses content warning Closes #57 --- pom.xml | 2 +- .../ripme/ripper/rippers/EHentaiRipper.java | 22 ++++++++++++++++++- .../com/rarchives/ripme/ui/UpdateUtils.java | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index e89c01c6..63d48fa8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rarchives.ripme ripme jar - 1.0.54 + 1.0.55 ripme http://rip.rarchives.com diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/EHentaiRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/EHentaiRipper.java index 4915a2e8..73bd633e 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/EHentaiRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/EHentaiRipper.java @@ -43,7 +43,17 @@ public class EHentaiRipper extends AlbumRipper { } 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 { @@ -88,6 +98,9 @@ public class EHentaiRipper extends AlbumRipper { int index = 0, retries = 3; String nextUrl = this.url.toExternalForm(); while (true) { + if (isStopped()) { + break; + } if (albumDoc == null) { logger.info(" Retrieving album page " + nextUrl); sendUpdate(STATUS.LOADING_RESOURCE, nextUrl); @@ -123,6 +136,9 @@ public class EHentaiRipper extends AlbumRipper { } // Iterate over images on page for (Element thumb : thumbs) { + if (isStopped()) { + break; + } index++; EHentaiImageThread t = new EHentaiImageThread(new URL(thumb.attr("href")), index, this.workingDir); ehentaiThreadPool.addThread(t); @@ -132,6 +148,10 @@ public class EHentaiRipper extends AlbumRipper { logger.warn("Interrupted while waiting to load next image", e); } } + + if (isStopped()) { + break; + } // Find next page Elements hrefs = albumDoc.select(".ptt a"); if (hrefs.size() == 0) { diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java index da09eefd..b83cba8b 100644 --- a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java +++ b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java @@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils; public class UpdateUtils { 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 updateJarURL = "http://rarchives.com/ripme.jar"; private static final String mainFileName = "ripme.jar";