Merge #451 from @cyian-1756/8muses

This commit fixes the naming issue with 8muse comic issues (A comic with the name format of Comic_name/issue_X would be written to a folder called issue_X instead of comic_name_issue_X)

Also fixes #461 (8muses URL format changed)
This commit is contained in:
metaprime 2017-03-01 02:08:45 -08:00 committed by GitHub
commit 88bf900196

View File

@ -40,7 +40,7 @@ public class EightmusesRipper extends AbstractHTMLRipper {
@Override @Override
public String getGID(URL url) throws MalformedURLException { public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("^https?://(www\\.)?8muses\\.com/index/category/([a-zA-Z0-9\\-_]+).*$"); Pattern p = Pattern.compile("^https?://(www\\.)?8muses\\.com/comix/album/([a-zA-Z0-9\\-_]+).*$");
Matcher m = p.matcher(url.toExternalForm()); Matcher m = p.matcher(url.toExternalForm());
if (!m.matches()) { if (!m.matches()) {
throw new MalformedURLException("Expected URL format: http://www.8muses.com/index/category/albumname, got: " + url); throw new MalformedURLException("Expected URL format: http://www.8muses.com/index/category/albumname, got: " + url);
@ -54,7 +54,8 @@ public class EightmusesRipper extends AbstractHTMLRipper {
// Attempt to use album title as GID // Attempt to use album title as GID
Element titleElement = getFirstPage().select("meta[name=description]").first(); Element titleElement = getFirstPage().select("meta[name=description]").first();
String title = titleElement.attr("content"); String title = titleElement.attr("content");
title = title.substring(title.lastIndexOf('/') + 1); title = title.replace("A huge collection of free porn comics for adults. Read", "");
title = title.replace("online for free at 8muses.com", "");
return getHost() + "_" + title.trim(); return getHost() + "_" + title.trim();
} catch (IOException e) { } catch (IOException e) {
// Fall back to default album naming convention // Fall back to default album naming convention
@ -122,14 +123,10 @@ public class EightmusesRipper extends AbstractHTMLRipper {
} }
try { try {
logger.info("Retrieving full-size image location from " + parentHref); logger.info("Retrieving full-size image location from " + parentHref);
Thread.sleep(1000);
image = getFullSizeImage(parentHref); image = getFullSizeImage(parentHref);
} catch (IOException e) { } catch (IOException e) {
logger.error("Failed to get full-size image from " + parentHref); logger.error("Failed to get full-size image from " + parentHref);
continue; continue;
} catch (InterruptedException e) {
logger.error("Interrupted while getting full-size image from " + parentHref);
continue;
} }
} }
if (!image.contains("8muses.com")) { if (!image.contains("8muses.com")) {