From 5af0f95a3a290c743cb3170ff5c5dd4f2f3e1dc3 Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Sat, 19 Dec 2015 06:46:43 -0800 Subject: [PATCH] Fix bugs in FuraffinityRipper --- .../ripme/ripper/rippers/FuraffinityRipper.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java index ed63305d..008a90ad 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/FuraffinityRipper.java @@ -95,10 +95,11 @@ public class FuraffinityRipper extends AbstractHTMLRipper { public Document getNextPage(Document doc) throws IOException { // Find next page Elements nextPageUrl = doc.select("td[align=right] form"); - String nextUrl = urlBase+nextPageUrl.first().attr("action"); if (nextPageUrl.size() == 0) { throw new IOException("No more pages"); } + String nextUrl = urlBase + nextPageUrl.first().attr("action"); + sleep(500); Document nextPage = Http.url(nextUrl).cookies(cookies).get(); @@ -156,7 +157,11 @@ public class FuraffinityRipper extends AbstractHTMLRipper { ele.select("p").prepend("\\n\\n"); logger.debug("Returning description at " + page); String tempPage = Jsoup.clean(ele.html().replaceAll("\\\\n", System.getProperty("line.separator")), "", Whitelist.none(), new Document.OutputSettings().prettyPrint(false)); - Element title = documentz.select("td[class=\"cat\"][valign=\"top\"] > b").get(0); + Elements titles = documentz.select("td[class=\"cat\"][valign=\"top\"] > b"); + if (titles.size() == 0) { + throw new IOException("No title found"); + } + Element title = titles.get(0); String tempText = title.text(); return tempText + "\n" + tempPage; // Overridden saveText takes first line and makes it the file name. } catch (IOException ioe) {