From 871e8984d8f22964275f1306d39fab9b34f96ab9 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Sat, 7 Jul 2018 04:03:59 -0400 Subject: [PATCH] Added getAlbumTitle for HitomiRipper --- .../ripme/ripper/rippers/HitomiRipper.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 53389a21..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); @@ -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));