diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/EightmusesRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/EightmusesRipper.java index 803a3bc5..ff72c9c6 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/EightmusesRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/EightmusesRipper.java @@ -107,18 +107,30 @@ public class EightmusesRipper extends AbstractHTMLRipper { } else { // Page contains images - for (Element thumb : page.select("img")) { + for (Element thumb : page.select("div.item .holder img")) { + if (super.isStopped()) break; // Find thumbnail image source String image = null; if (thumb.hasAttr("data-cfsrc")) { image = thumb.attr("data-cfsrc"); } - else if (thumb.hasAttr("src")) { - image = thumb.attr("src"); - } else { - logger.warn("Thumb does not have data-cfsrc or src: " + thumb); - continue; + String parentHref = thumb.parent().attr("href"); + if (parentHref.equals("")) continue; + if (parentHref.startsWith("/")) { + parentHref = "https://www.8muses.com" + parentHref; + } + try { + logger.info("Retrieving full-size image location from " + parentHref); + Thread.sleep(1000); + image = getFullSizeImage(parentHref); + } catch (IOException e) { + logger.error("Failed to get full-size image from " + parentHref); + continue; + } catch (InterruptedException e) { + logger.error("Interrupted while getting full-size image from " + parentHref); + continue; + } } if (!image.contains("8muses.com")) { // Not hosted on 8mues. @@ -135,11 +147,17 @@ public class EightmusesRipper extends AbstractHTMLRipper { } image = image.replaceAll(" ", "%20"); imageURLs.add(image); + if (isThisATest()) break; } } return imageURLs; } + private String getFullSizeImage(String imageUrl) throws IOException { + Document doc = new Http(imageUrl).get(); + return doc.select("#image").first().attr("src"); + } + @Override public void downloadURL(URL url, int index) { addURLToDownload(url, getPrefix(index), "", this.url.toExternalForm(), cookies); diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java index 906728bf..e7dfa70c 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java @@ -60,6 +60,8 @@ public class BasicRippersTest extends RippersTest { public void testEightmusesAlbum() throws IOException { EightmusesRipper ripper = new EightmusesRipper(new URL("http://www.8muses.com/index/category/jab-hotassneighbor7")); testRipper(ripper); + ripper = new EightmusesRipper(new URL("https://www.8muses.com/album/jab-comics/a-model-life")); + testRipper(ripper); } public void testVineboxAlbum() throws IOException {