Added getAlbumTitle for HitomiRipper

This commit is contained in:
cyian-1756 2018-07-07 04:03:59 -04:00
parent c8e8139cf6
commit 871e8984d8

View File

@ -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));