1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-01-18 21:17:59 +01:00

Fixed deviantArt ripping

Uses the data-super-full-img attribute of thumbnails as first attempt to
get a full image URL. If that doesn't work (as is the case with mature
items), the JSON is used. thumbToFull is still broken in this commit,
but shouldn't be needed.
This commit is contained in:
Wiiplay123 2017-04-25 20:17:26 -05:00
parent 7a1777386e
commit c3d1c7b654

View File

@ -125,7 +125,7 @@ public class DeviantartRipper extends AbstractHTMLRipper {
List<String> imageURLs = new ArrayList<String>(); List<String> imageURLs = new ArrayList<String>();
// Iterate over all thumbnails // Iterate over all thumbnails
for (Element thumb : page.select("div.zones-container a.thumb")) { for (Element thumb : page.select("div.zones-container span.thumb")) {
if (isStopped()) { if (isStopped()) {
break; break;
} }
@ -133,15 +133,33 @@ public class DeviantartRipper extends AbstractHTMLRipper {
if (img.attr("transparent").equals("false")) { if (img.attr("transparent").equals("false")) {
continue; // a.thumbs to other albums are invisible continue; // a.thumbs to other albums are invisible
} }
// Get full-sized image via helper methods // Get full-sized image via helper methods
String fullSize = null; String fullSize = null;
try { if (!thumb.attr("data-super-full-img").isEmpty()) {
fullSize = thumbToFull(img.attr("src"), true); fullSize = thumb.attr("data-super-full-img");
} catch (Exception e) { } else {
logger.info("Attempting to get full size image from " + thumb.attr("href")); String spanUrl = thumb.attr("href");
fullSize = smallToFull(img.attr("src"), thumb.attr("href")); // id = spanUrl.substring(spanUrl.lastIndexOf('-') + 1)
} Elements js = page.select("script[type=\"text/javascript\"]");
for (Element tag : js) {
if (tag.html().contains("window.__pageload")) {
String script = tag.html();
script = script.substring(script.indexOf("window.__pageload"));
script = script.substring(script.indexOf(spanUrl.substring(spanUrl.lastIndexOf('-') + 1)));
script = script.substring(script.indexOf("},\"src\":\"") + 9,script.indexOf("\",\"type\"")); // first },"src":"url" after id
fullSize = script.replace("\\/","/");
break;
}
}
if (fullSize == null) {
try {
fullSize = thumbToFull(img.attr("src"), true);
} catch (Exception e) {
logger.info("Attempting to get full size image from " + thumb.attr("href"));
fullSize = smallToFull(img.attr("src"), thumb.attr("href"));
}
}
}
if (fullSize == null) { if (fullSize == null) {
continue; continue;
} }