diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..bde22831 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "files.exclude": { + "target/**": true, + "**/.git": true, + "**/.DS_Store": true + }, + "java.configuration.updateBuildConfiguration": "automatic" +} diff --git a/pom.xml b/pom.xml index 78d9ddce..f864208a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rarchives.ripme ripme jar - 1.4.8 + 1.4.9 ripme http://rip.rarchives.com diff --git a/ripme.json b/ripme.json index fc370e76..71d1abf5 100644 --- a/ripme.json +++ b/ripme.json @@ -1,6 +1,7 @@ { - "latestVersion" : "1.4.8", + "latestVersion" : "1.4.9", "changeList" : [ + "1.4.9: Fixed HentaiFoundry ripper", "1.4.8: Added Jagodibuja comics ripper", "1.4.7: Fixed NewsFilter, XHamster; added TheChiveRipper", "1.4.6: Eroshare: get album names; Imgur: improve grabbing album name.", diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/HentaifoundryRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/HentaifoundryRipper.java index d476969d..ca4e906e 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/HentaifoundryRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/HentaifoundryRipper.java @@ -55,6 +55,7 @@ public class HentaifoundryRipper extends AbstractHTMLRipper { .referrer("http://www.hentai-foundry.com/") .cookies(cookies) .response(); + // The only cookie that seems to matter in getting around the age wall is the phpsession cookie cookies.putAll(resp.cookies()); sleep(500); resp = Http.url(url) @@ -64,10 +65,10 @@ public class HentaifoundryRipper extends AbstractHTMLRipper { cookies.putAll(resp.cookies()); return resp.parse(); } - + @Override public Document getNextPage(Document doc) throws IOException { - if (doc.select("li.next.hidden").size() > 0) { + if (doc.select("li.next.hidden").size() != 0) { // Last page throw new IOException("No more pages"); } @@ -85,7 +86,7 @@ public class HentaifoundryRipper extends AbstractHTMLRipper { public List getURLsFromPage(Document doc) { List imageURLs = new ArrayList(); Pattern imgRegex = Pattern.compile(".*/user/([a-zA-Z0-9\\-_]+)/(\\d+)/.*"); - for (Element thumb : doc.select("td > a:first-child")) { + for (Element thumb : doc.select("div.thumb_square > a.thumbLink")) { if (isStopped()) { break; } @@ -94,16 +95,36 @@ public class HentaifoundryRipper extends AbstractHTMLRipper { logger.info("Couldn't find user & image ID in " + thumb.attr("href")); continue; } - String user = imgMatcher.group(1), - imageId = imgMatcher.group(2); - String image = "http://pictures.hentai-foundry.com//"; - image += user.toLowerCase().charAt(0); - image += "/" + user + "/" + imageId + ".jpg"; - imageURLs.add(image); + Document imagePage; + try { + Response resp = Http.url("http://www.hentai-foundry.com/").response(); + cookies = resp.cookies(); + resp = Http.url("http://www.hentai-foundry.com/?enterAgree=1&size=1500") + .referrer("http://www.hentai-foundry.com/") + .cookies(cookies) + .response(); + cookies.putAll(resp.cookies()); + + logger.info("grabbing " + "http://www.hentai-foundry.com" + thumb.attr("href")); + imagePage = Http.url("http://www.hentai-foundry.com" + thumb.attr("href")).cookies(cookies).get(); + } + + catch (IOException e) { + logger.debug(e.getMessage()); + logger.debug("Warning: imagePage is null!"); + imagePage = null; + } + // This is here for when the image is resized to a thumbnail because ripme doesn't report a screensize + if (imagePage.select("div.boxbody > img.center").attr("src").contains("thumbs.") == true) { + imageURLs.add("http:" + imagePage.select("div.boxbody > img.center").attr("onclick").replace("this.src=", "").replace("'", "").replace("; $(#resize_message).hide();", "")); + } + else { + imageURLs.add("http:" + imagePage.select("div.boxbody > img.center").attr("src")); + } } return imageURLs; } - + @Override public void downloadURL(URL url, int index) { addURLToDownload(url, getPrefix(index)); diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java index 13d83446..a5cb68f4 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.4.8"; + private static final String DEFAULT_VERSION = "1.4.9"; private static final String updateJsonURL = "https://raw.githubusercontent.com/4pr0n/ripme/master/ripme.json"; private static final String mainFileName = "ripme.jar"; private static final String updateFileName = "ripme.jar.update";