Updated 8muses ripper to working status

This commit is contained in:
John Gibson 2016-12-16 00:03:16 -05:00 committed by metaprime
parent 08ce833863
commit e149876dda

View File

@ -107,7 +107,7 @@ public class EightmusesRipper extends AbstractHTMLRipper {
} }
else { else {
// Page contains images // Page contains images
for (Element thumb : page.select("div.item .holder img")) { for (Element thumb : page.select(".image")) {
if (super.isStopped()) break; if (super.isStopped()) break;
// Find thumbnail image source // Find thumbnail image source
String image = null; String image = null;
@ -133,19 +133,9 @@ public class EightmusesRipper extends AbstractHTMLRipper {
} }
} }
if (!image.contains("8muses.com")) { if (!image.contains("8muses.com")) {
// Not hosted on 8mues. // Not hosted on 8muses.
continue; continue;
} }
// Remove relative directory path naming
image = image.replaceAll("\\.\\./", "");
if (image.startsWith("//")) {
image = "http:" + image;
}
// Convert from thumb URL to full-size
if (image.contains("-cu_")) {
image = image.replaceAll("-cu_[^.]+", "-me");
}
image = image.replaceAll(" ", "%20");
imageURLs.add(image); imageURLs.add(image);
if (isThisATest()) break; if (isThisATest()) break;
} }
@ -155,8 +145,10 @@ public class EightmusesRipper extends AbstractHTMLRipper {
private String getFullSizeImage(String imageUrl) throws IOException { private String getFullSizeImage(String imageUrl) throws IOException {
sendUpdate(STATUS.LOADING_RESOURCE, imageUrl); sendUpdate(STATUS.LOADING_RESOURCE, imageUrl);
Document doc = new Http(imageUrl).get(); Document doc = new Http(imageUrl).get(); // Retrieve the webpage of the image URL
return doc.select("#image").first().attr("src"); Element fullSizeImage = doc.select(".photo").first(); // Select the "photo" element from the page (there should only be 1)
String path = "https://www.8muses.com/data/fu/" + fullSizeImage.children().select("#imageName").attr("value"); // Append the path to the fullsize image file to the standard prefix
return path;
} }
@Override @Override