From e88d00ddeed5ae9c583ed57bbcab63e8cba380e6 Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Sat, 7 Jun 2014 17:35:58 -0700 Subject: [PATCH] Fix for ehentai restricted galleries for #57 --- pom.xml | 2 +- .../ripme/ripper/rippers/EHentaiRipper.java | 16 +++++----------- .../java/com/rarchives/ripme/ui/UpdateUtils.java | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index b4cc8d00..0b5715a9 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rarchives.ripme ripme jar - 1.0.57 + 1.0.58 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 73bd633e..671548cd 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/EHentaiRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/EHentaiRipper.java @@ -43,17 +43,7 @@ public class EHentaiRipper extends AlbumRipper { } public URL sanitizeURL(URL url) throws MalformedURLException { - 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); + return url; } public String getAlbumTitle(URL url) throws MalformedURLException { @@ -64,6 +54,8 @@ public class EHentaiRipper extends AlbumRipper { sendUpdate(STATUS.LOADING_RESOURCE, url.toString()); albumDoc = Jsoup.connect(url.toExternalForm()) .userAgent(USER_AGENT) + .cookie("nw", "1") + .cookie("tip", "1") .timeout(5000) .get(); } @@ -106,6 +98,7 @@ public class EHentaiRipper extends AlbumRipper { sendUpdate(STATUS.LOADING_RESOURCE, nextUrl); albumDoc = Jsoup.connect(nextUrl) .userAgent(USER_AGENT) + .cookie("nw", "1") .timeout(5000) .referrer(this.url.toExternalForm()) .get(); @@ -211,6 +204,7 @@ public class EHentaiRipper extends AlbumRipper { try { Document doc = Jsoup.connect(this.url.toExternalForm()) .userAgent(USER_AGENT) + .cookie("nw", "1") .timeout(5000) .referrer(this.url.toExternalForm()) .get(); diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java index 212a379c..8fa32ded 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.57"; + private static final String DEFAULT_VERSION = "1.0.58"; 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";