Now downloads full sized images

This commit is contained in:
cyian-1756 2017-10-13 21:32:34 -04:00
parent 4f8a68d5fc
commit 6db0c5eb5f

View File

@ -68,13 +68,18 @@ public class SankakuComplexRipper extends AbstractHTMLRipper {
List<String> imageURLs = new ArrayList<String>(); List<String> imageURLs = new ArrayList<String>();
// Image URLs are basically thumbnail URLs with a different domain, a simple // 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) // path replacement, and a ?xxxxxx post ID at the end (obtainable from the href)
for (Element thumbSpan : doc.select("div.content > div > span.thumb")) { for (Element thumbSpan : doc.select("div.content > div > span.thumb > a")) {
String postId = thumbSpan.attr("id").replaceAll("p", "");
Element thumb = thumbSpan.getElementsByTag("img").first(); String postLink = thumbSpan.attr("href");
String image = thumb.attr("abs:src") try {
.replace(".sankakucomplex.com/data/preview", // Get the page the full sized image is on
"s.sankakucomplex.com/data") + "?" + postId; Document subPage = Http.url("https://chan.sankakucomplex.com" + postLink).get();
imageURLs.add(image); 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; return imageURLs;
} }
@ -82,8 +87,8 @@ public class SankakuComplexRipper extends AbstractHTMLRipper {
@Override @Override
public void downloadURL(URL url, int index) { 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. // Mock up the URL of the post page based on the post ID at the end of the URL.
String postId = url.toExternalForm().replaceAll(".*\\?", ""); sleep(10000);
addURLToDownload(url, postId + "_", "", "", null); addURLToDownload(url, getPrefix(index));
} }
@Override @Override