From 6db0c5eb5f06399c62e86791835ae332bbb2e5bb Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Fri, 13 Oct 2017 21:32:34 -0400 Subject: [PATCH] Now downloads full sized images --- .../ripper/rippers/SankakuComplexRipper.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/SankakuComplexRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/SankakuComplexRipper.java index cbd922bb..9d29b08a 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/SankakuComplexRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/SankakuComplexRipper.java @@ -68,13 +68,18 @@ public class SankakuComplexRipper extends AbstractHTMLRipper { List imageURLs = new ArrayList(); // Image URLs are basically thumbnail URLs with a different domain, a simple // path replacement, and a ?xxxxxx post ID at the end (obtainable from the href) - for (Element thumbSpan : doc.select("div.content > div > span.thumb")) { - String postId = thumbSpan.attr("id").replaceAll("p", ""); - Element thumb = thumbSpan.getElementsByTag("img").first(); - String image = thumb.attr("abs:src") - .replace(".sankakucomplex.com/data/preview", - "s.sankakucomplex.com/data") + "?" + postId; - imageURLs.add(image); + for (Element thumbSpan : doc.select("div.content > div > span.thumb > a")) { + + String postLink = thumbSpan.attr("href"); + try { + // Get the page the full sized image is on + Document subPage = Http.url("https://chan.sankakucomplex.com" + postLink).get(); + imageURLs.add("https:" + subPage.select("div[id=post-content] > a.sample > img").attr("src")); + } catch (IOException e) { + logger.warn("Error while loading page " + postLink, e); + continue; + } + } return imageURLs; } @@ -82,8 +87,8 @@ public class SankakuComplexRipper extends AbstractHTMLRipper { @Override public void downloadURL(URL url, int index) { // Mock up the URL of the post page based on the post ID at the end of the URL. - String postId = url.toExternalForm().replaceAll(".*\\?", ""); - addURLToDownload(url, postId + "_", "", "", null); + sleep(10000); + addURLToDownload(url, getPrefix(index)); } @Override