jagodibuja: fixed formatting

This commit is contained in:
metaprime 2017-04-25 10:09:00 -07:00
parent f089e804fd
commit dbb926824a

View File

@ -19,64 +19,62 @@ import com.rarchives.ripme.utils.Http;
public class JagodibujaRipper extends AbstractHTMLRipper { public class JagodibujaRipper extends AbstractHTMLRipper {
public JagodibujaRipper(URL url) throws IOException { public JagodibujaRipper(URL url) throws IOException {
super(url); super(url);
} }
@Override
public String getHost() {
return "jagodibuja";
}
@Override @Override
public String getDomain() { public String getHost() {
return "jagodibuja.com"; return "jagodibuja";
} }
@Override @Override
public String getGID(URL url) throws MalformedURLException { public String getDomain() {
Pattern p = Pattern.compile("^https?://www.jagodibuja.com/([a-zA-Z0-9_-]*)/?"); return "jagodibuja.com";
Matcher m = p.matcher(url.toExternalForm()); }
if (m.matches()) {
return m.group(1);
}
throw new MalformedURLException("Expected jagodibuja.com gallery formats hwww.jagodibuja.com/Comic name/ got " + url + " instead");
}
@Override @Override
public Document getFirstPage() throws IOException { public String getGID(URL url) throws MalformedURLException {
// "url" is an instance field of the superclass Pattern p = Pattern.compile("^https?://www.jagodibuja.com/([a-zA-Z0-9_-]*)/?");
return Http.url(url).get(); Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) {
return m.group(1);
} }
throw new MalformedURLException("Expected jagodibuja.com gallery formats hwww.jagodibuja.com/Comic name/ got " + url + " instead");
}
@Override @Override
public List<String> getURLsFromPage(Document doc) { public Document getFirstPage() throws IOException {
List<String> result = new ArrayList<String>(); // "url" is an instance field of the superclass
for (Element comicPageUrl : doc.select("div.gallery-icon > a")) { return Http.url(url).get();
}
@Override
public List<String> getURLsFromPage(Document doc) {
List<String> result = new ArrayList<String>();
for (Element comicPageUrl : doc.select("div.gallery-icon > a")) {
try {
sleep(500);
Document comicPage = Http.url(comicPageUrl.attr("href")).get();
Element elem = comicPage.select("span.full-size-link > a").first();
logger.info("Got link " + elem.attr("href"));
try { try {
sleep(500); addURLToDownload(new URL(elem.attr("href")), "");
Document comicPage = Http.url(comicPageUrl.attr("href")).get(); } catch (MalformedURLException e) {
Element elem = comicPage.select("span.full-size-link > a").first(); logger.warn("Malformed URL");
logger.info("Got link " + elem.attr("href")); e.printStackTrace();
try {
addURLToDownload(new URL(elem.attr("href")), "");
}
catch(MalformedURLException e) {
logger.warn("Malformed URL");
e.printStackTrace();
}
result.add(elem.attr("href"));
}
catch(IOException e) {
logger.info("Error loading " + comicPageUrl);
} }
result.add(elem.attr("href"));
} catch (IOException e) {
logger.info("Error loading " + comicPageUrl);
} }
return result;
} }
return result;
@Override
public void downloadURL(URL url, int index) {
// sleep(500);
// addURLToDownload(url, getPrefix(index));
}
} }
@Override
public void downloadURL(URL url, int index) {
// sleep(500);
// addURLToDownload(url, getPrefix(index));
}
}