diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/HitomiRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/HitomiRipper.java index c5f0bbd4..fd080d35 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/HitomiRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/HitomiRipper.java @@ -13,10 +13,11 @@ import org.jsoup.nodes.Document; import com.rarchives.ripme.ripper.AbstractHTMLRipper; import com.rarchives.ripme.utils.Http; +import org.jsoup.nodes.Element; public class HitomiRipper extends AbstractHTMLRipper { - String galleryId = ""; + private String galleryId = ""; public HitomiRipper(URL url) throws IOException { super(url); @@ -47,7 +48,7 @@ public class HitomiRipper extends AbstractHTMLRipper { @Override public Document getFirstPage() throws IOException { // if we go to /GALLERYID.js we get a nice json array of all images in the gallery - return Http.url(new URL(url.toExternalForm().replaceAll(".html", ".js"))).ignoreContentType().get(); + return Http.url(new URL(url.toExternalForm().replaceAll("hitomi", "ltn.hitomi").replaceAll(".html", ".js"))).ignoreContentType().get(); } @@ -64,6 +65,19 @@ public class HitomiRipper extends AbstractHTMLRipper { return result; } + @Override + public String getAlbumTitle(URL url) throws MalformedURLException { + try { + // Attempt to use album title and username as GID + Document doc = Http.url(url).get(); + return getHost() + "_" + getGID(url) + "_" + + doc.select("title").text().replaceAll(" - Read Online - hentai artistcg \\| Hitomi.la", ""); + } catch (IOException e) { + LOGGER.info("Falling back"); + } + return super.getAlbumTitle(url); + } + @Override public void downloadURL(URL url, int index) { addURLToDownload(url, getPrefix(index));