Now cna rip all comics from jagodibuja.com

This commit is contained in:
cyian-1756 2017-04-25 07:31:04 -04:00
parent 1849fdba2d
commit 17b4f5fc32

View File

@ -33,12 +33,12 @@ public class JagodibujaRipper extends AbstractHTMLRipper {
@Override @Override
public String getGID(URL url) throws MalformedURLException { public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("^https?://www.jagodibuja.com/webcomic-living-with-hipstergirl-and-gamergirl-english/?"); Pattern p = Pattern.compile("^https?://www.jagodibuja.com/([a-zA-Z0-9_-]*)/?");
Matcher m = p.matcher(url.toExternalForm()); Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) { if (m.matches()) {
return "living-with-hipstergirl-and-gamergirl"; return m.group(1);
} }
throw new MalformedURLException("Expected jagodibuja.com gallery formats hwww.jagodibuja.com/webcomic-living-with-hipstergirl-and-gamergirl-english/ got " + url + " instead"); throw new MalformedURLException("Expected jagodibuja.com gallery formats hwww.jagodibuja.com/Comic name/ got " + url + " instead");
} }
@Override @Override
@ -47,24 +47,6 @@ public class JagodibujaRipper extends AbstractHTMLRipper {
return Http.url(url).get(); return Http.url(url).get();
} }
// @Override
// public Document getNextPage(Document doc) throws IOException {
// // Find next page
// String nextPage = "";
// Element elem = null;
// elem = doc.select("div.entry-attachment > div.attachment > a").first();
// if (elem == null) {
// throw new IOException("No more pages");
// }
// nextPage = elem.attr("href");
// if (nextPage == "") {
// throw new IOException("No more pages");
// }
// else {
// return Http.url(nextPage).get();
// }
// }
@Override @Override
public List<String> getURLsFromPage(Document doc) { public List<String> getURLsFromPage(Document doc) {
List<String> result = new ArrayList<String>(); List<String> result = new ArrayList<String>();
@ -81,7 +63,7 @@ public class JagodibujaRipper extends AbstractHTMLRipper {
logger.warn("Malformed URL"); logger.warn("Malformed URL");
e.printStackTrace(); e.printStackTrace();
} }
// result.add(elem.attr("href")); result.add(elem.attr("href"));
} }
catch(IOException e) { catch(IOException e) {
logger.info("Error loading " + comicPageUrl); logger.info("Error loading " + comicPageUrl);
@ -92,8 +74,8 @@ public class JagodibujaRipper extends AbstractHTMLRipper {
@Override @Override
public void downloadURL(URL url, int index) { public void downloadURL(URL url, int index) {
sleep(500); // sleep(500);
addURLToDownload(url, getPrefix(index)); // addURLToDownload(url, getPrefix(index));
} }