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>();
// 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