removed the unused g subdomain from the ehentai ripper (#453)

This commit is contained in:
cyian-1756 2017-02-22 01:24:52 -05:00 committed by metaprime
parent 334a124b9f
commit 06e88efedf

View File

@ -38,7 +38,7 @@ public class EHentaiRipper extends AbstractHTMLRipper {
// Current HTML document // Current HTML document
private Document albumDoc = null; private Document albumDoc = null;
private static final Map<String,String> cookies = new HashMap<String,String>(); private static final Map<String,String> cookies = new HashMap<String,String>();
static { static {
cookies.put("nw", "1"); cookies.put("nw", "1");
@ -53,10 +53,10 @@ public class EHentaiRipper extends AbstractHTMLRipper {
public String getHost() { public String getHost() {
return "e-hentai"; return "e-hentai";
} }
@Override @Override
public String getDomain() { public String getDomain() {
return "g.e-hentai.org"; return "e-hentai.org";
} }
public String getAlbumTitle(URL url) throws MalformedURLException { public String getAlbumTitle(URL url) throws MalformedURLException {
@ -79,18 +79,18 @@ public class EHentaiRipper extends AbstractHTMLRipper {
Pattern p; Pattern p;
Matcher m; Matcher m;
p = Pattern.compile("^.*g\\.e-hentai\\.org/g/([0-9]+)/([a-fA-F0-9]+)/$"); p = Pattern.compile("^https?://e-hentai\\.org/g/([0-9]+)/([a-fA-F0-9]+)/$");
m = p.matcher(url.toExternalForm()); m = p.matcher(url.toExternalForm());
if (m.matches()) { if (m.matches()) {
return m.group(1) + "-" + m.group(2); return m.group(1) + "-" + m.group(2);
} }
throw new MalformedURLException( throw new MalformedURLException(
"Expected g.e-hentai.org gallery format: " "Expected e-hentai.org gallery format: "
+ "http://g.e-hentai.org/g/####/####/" + "http://e-hentai.org/g/####/####/"
+ " Got: " + url); + " Got: " + url);
} }
/** /**
* Attempts to get page, checks for IP ban, waits. * Attempts to get page, checks for IP ban, waits.
* @param url * @param url
@ -185,7 +185,7 @@ public class EHentaiRipper extends AbstractHTMLRipper {
/** /**
* Helper class to find and download images found on "image" pages * Helper class to find and download images found on "image" pages
* *
* Handles case when site has IP-banned the user. * Handles case when site has IP-banned the user.
*/ */
private class EHentaiImageThread extends Thread { private class EHentaiImageThread extends Thread {
@ -204,7 +204,7 @@ public class EHentaiRipper extends AbstractHTMLRipper {
public void run() { public void run() {
fetchImage(); fetchImage();
} }
private void fetchImage() { private void fetchImage() {
try { try {
Document doc = getPageWithRetries(this.url); Document doc = getPageWithRetries(this.url);
@ -246,4 +246,4 @@ public class EHentaiRipper extends AbstractHTMLRipper {
} }
} }
} }
} }