From 763a7445bfd74c4f9aef63074648591b139db406 Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Mon, 21 Jul 2014 03:02:19 -0700 Subject: [PATCH] 1.0.79 - Support for ripping all images from cheeby --- pom.xml | 2 +- .../ripme/ripper/rippers/CheebyRipper.java | 17 ++++++++++++++++- .../com/rarchives/ripme/ui/UpdateUtils.java | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 34b72db7..c3298739 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rarchives.ripme ripme jar - 1.0.78 + 1.0.79 ripme http://rip.rarchives.com diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/CheebyRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/CheebyRipper.java index c09d615f..c9e18454 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/CheebyRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/CheebyRipper.java @@ -16,6 +16,8 @@ import com.rarchives.ripme.utils.Http; public class CheebyRipper extends AbstractHTMLRipper { + private int offset = 0; + public CheebyRipper(URL url) throws IOException { super(url); } @@ -46,10 +48,23 @@ public class CheebyRipper extends AbstractHTMLRipper { @Override public Document getFirstPage() throws IOException { - return Http.url(this.url) + String url = this.url + "?limit=10&offset=0"; + return Http.url(url) .get(); } + @Override + public Document getNextPage(Document doc) throws IOException { + sleep(500); + offset += 10; + String url = this.url + "?limit=10&offset=" + offset; + Document nextDoc = Http.url(url).get(); + if (nextDoc.select("div.i a img").size() == 0) { + throw new IOException("No more images to fetch"); + } + return nextDoc; + } + @Override public List getURLsFromPage(Document page) { List imageURLs = new ArrayList(); diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java index d101b9f0..a777e16f 100644 --- a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java +++ b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java @@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils; public class UpdateUtils { private static final Logger logger = Logger.getLogger(UpdateUtils.class); - private static final String DEFAULT_VERSION = "1.0.78"; + private static final String DEFAULT_VERSION = "1.0.79"; private static final String updateJsonURL = "http://rarchives.com/ripme.json"; private static final String updateJarURL = "http://rarchives.com/ripme.jar"; private static final String mainFileName = "ripme.jar";