From 4cf9f09293390d4ce2aca4cc6c78f1201a10b8a7 Mon Sep 17 00:00:00 2001 From: Wiiplay123 Date: Thu, 27 Apr 2017 00:18:42 -0500 Subject: [PATCH] Fixed deviantArt "no next page found" error The pagination buttons are gone. The "coffset" buttons for comment pages, not gallery pages. I patched this by using a link found in the HTML itself that I think is used by JavaScript to generate the pagination buttons. --- .../ripme/ripper/rippers/DeviantartRipper.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java index b717437f..cde05d9f 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java @@ -201,14 +201,15 @@ public class DeviantartRipper extends AbstractHTMLRipper { if (isThisATest()) { return null; } - Elements nextButtons = page.select("li.next > a"); + Elements nextButtons = page.select("link[rel=\"next\"]"); if (nextButtons.size() == 0) { - throw new IOException("No next page found"); + if (page.select("link[rel=\"prev\"]").size() == 0) { + throw new IOException("No next page found"); + } else { + throw new IOException("Hit end of pages"); + } } Element a = nextButtons.first(); - if (a.hasClass("disabled")) { - throw new IOException("Hit end of pages"); - } String nextPage = a.attr("href"); if (nextPage.startsWith("/")) { nextPage = "http://" + this.url.getHost() + nextPage; @@ -306,7 +307,7 @@ public class DeviantartRipper extends AbstractHTMLRipper { if (fullSize == null) { return new String[] {Jsoup.clean(ele.html().replaceAll("\\\\n", System.getProperty("line.separator")), "", Whitelist.none(), new Document.OutputSettings().prettyPrint(false))}; } - fullSize = fullSize.substring(0,fullSize.lastIndexOf(".")); + fullSize = fullSize.substring(0, fullSize.lastIndexOf(".")); return new String[] {Jsoup.clean(ele.html().replaceAll("\\\\n", System.getProperty("line.separator")), "", Whitelist.none(), new Document.OutputSettings().prettyPrint(false)),fullSize}; // TODO Make this not make a newline if someone just types \n into the description. } catch (IOException ioe) {