Merge pull request #576 from cyian-1756/hentai2readFixes

Fixed hentai2read ripper
This commit is contained in:
cyian-1756 2018-05-13 09:09:24 -04:00 committed by GitHub
commit 5fc79eb658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,20 +44,15 @@ public class Hentai2readRipper extends AbstractHTMLRipper {
@Override @Override
public Document getFirstPage() throws IOException { public Document getFirstPage() throws IOException {
Document tempDoc; try {
// get the first page of the comic Document tempDoc;
if (url.toExternalForm().substring(url.toExternalForm().length() - 1).equals("/")) { tempDoc = Http.url(url).get();
tempDoc = Http.url(url + "1").get(); // Get the thumbnail page so we can rip all images without loading every page in the comic
} else { String thumbnailLink = tempDoc.select("a[data-original-title=Thumbnails").attr("href");
tempDoc = Http.url(url + "/1").get(); 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 @Override