Added ASAP ripping to Myhentaicomics ripper (#476)

This commit is contained in:
cyian-1756 2017-05-09 17:11:17 -04:00 committed by metaprime
parent 34f2909050
commit a38597d6fe

View File

@ -157,13 +157,29 @@ public class MyhentaicomicsRipper extends AbstractHTMLRipper {
if (b == false) { if (b == false) {
// We replace thumbs with resizes so we can the full sized images // We replace thumbs with resizes so we can the full sized images
imageSource = imageSource.replace("thumbs", "resizes"); imageSource = imageSource.replace("thumbs", "resizes");
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); result.add("http://myhentaicomics.com/" + imageSource);
} }
} }
} }
} }
} }
return result;
}
else { else {
for (Element el : doc.select("img")) { for (Element el : doc.select("img")) {
String imageSource = el.attr("src"); String imageSource = el.attr("src");
@ -181,20 +197,8 @@ public class MyhentaicomicsRipper extends AbstractHTMLRipper {
@Override @Override
public void downloadURL(URL url, int index) { 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));
} }
}
} }