From a38597d6fe69ab34d7293cca85c5c769990abef1 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Tue, 9 May 2017 17:11:17 -0400 Subject: [PATCH] Added ASAP ripping to Myhentaicomics ripper (#476) --- .../ripper/rippers/MyhentaicomicsRipper.java | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/MyhentaicomicsRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/MyhentaicomicsRipper.java index 950d8da4..32612012 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/MyhentaicomicsRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/MyhentaicomicsRipper.java @@ -157,12 +157,28 @@ public class MyhentaicomicsRipper extends AbstractHTMLRipper { if (b == false) { // We replace thumbs with resizes so we can the full sized images imageSource = imageSource.replace("thumbs", "resizes"); - result.add("http://myhentaicomics.com/" + imageSource); + String url_string = "http://myhentaicomics.com/" + imageSource; + url_string = url_string.replace("%20", "_"); + url_string = url_string.replace("%27", ""); + url_string = url_string.replace("%28", "_"); + url_string = url_string.replace("%29", "_"); + url_string = url_string.replace("%2C", "_"); + if (isTag == true) { + logger.info("Downloading from a tag or search"); + try { + addURLToDownload(new URL("http://myhentaicomics.com/" + imageSource), "", url_string.split("/")[6]); + } + catch(MalformedURLException e) { + logger.warn("Malformed URL"); + e.printStackTrace(); + } + result.add("http://myhentaicomics.com/" + imageSource); + } + } } } - } - } + return result; } else { for (Element el : doc.select("img")) { @@ -181,19 +197,7 @@ public class MyhentaicomicsRipper extends AbstractHTMLRipper { @Override public void downloadURL(URL url, int index) { - String url_string = url.toExternalForm(); - url_string = url_string.replace("%20", "_"); - url_string = url_string.replace("%27", ""); - url_string = url_string.replace("%28", "_"); - url_string = url_string.replace("%29", "_"); - url_string = url_string.replace("%2C", "_"); - if (isTag == true) { - logger.info("Downloading from a tag or search"); - addURLToDownload(url, getPrefix(index), url_string.split("/")[6]); - } - else { - addURLToDownload(url, getPrefix(index)); - } + addURLToDownload(url, getPrefix(index)); }