From 03963eac55e22b05f2af538232c169a05b50789b Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Fri, 11 May 2018 23:56:02 -0400 Subject: [PATCH] Fixed hentai2read ripper --- .../ripper/rippers/Hentai2readRipper.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/Hentai2readRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/Hentai2readRipper.java index 405d0563..a87575bd 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/Hentai2readRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/Hentai2readRipper.java @@ -44,20 +44,15 @@ public class Hentai2readRipper extends AbstractHTMLRipper { @Override public Document getFirstPage() throws IOException { - Document tempDoc; - // get the first page of the comic - if (url.toExternalForm().substring(url.toExternalForm().length() - 1).equals("/")) { - tempDoc = Http.url(url + "1").get(); - } else { - tempDoc = Http.url(url + "/1").get(); + try { + Document tempDoc; + tempDoc = Http.url(url).get(); + // Get the thumbnail page so we can rip all images without loading every page in the comic + String thumbnailLink = tempDoc.select("a[data-original-title=Thumbnails").attr("href"); + return Http.url(thumbnailLink).get(); + } catch (IOException e) { + throw new IOException("Unable to get first page"); } - for (Element el : tempDoc.select("ul.nav > li > a")) { - if (el.attr("href").startsWith("https://hentai2read.com/thumbnails/")) { - // Get the page with the thumbnails - return Http.url(el.attr("href")).get(); - } - } - throw new IOException("Unable to get first page"); } @Override