Removed getnextpage; add support for quickQueue

This commit is contained in:
cyian-1756 2018-05-17 20:07:16 -04:00
parent 9281766a71
commit bb60779469

View File

@ -38,10 +38,40 @@ public class BatoRipper extends AbstractHTMLRipper {
if (m.matches()) {
return m.group(1);
}
// As this is just for quick queue support it does matter what this if returns
p = Pattern.compile("https?://bato.to/series/([\\d]+)/?");
m = p.matcher(url.toExternalForm());
if (m.matches()) {
return "";
}
throw new MalformedURLException("Expected bato.to URL format: " +
"bato.to/chapter/ID - got " + url + " instead");
}
@Override
public boolean hasQueueSupport() {
return true;
}
@Override
public boolean pageContainsAlbums(URL url) {
Pattern p = Pattern.compile("https?://bato.to/series/([\\d]+)/?");
Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) {
return true;
}
return false;
}
@Override
public List<String> getAlbumsToQueue(Document doc) {
List<String> urlsToAddToQueue = new ArrayList<>();
for (Element elem : doc.select("div.main > div > a")) {
urlsToAddToQueue.add("https://" + getDomain() + elem.attr("href"));
}
return urlsToAddToQueue;
}
@Override
public String getAlbumTitle(URL url) throws MalformedURLException {
try {
@ -76,20 +106,6 @@ public class BatoRipper extends AbstractHTMLRipper {
return Http.url(url).get();
}
@Override
public Document getNextPage(Document doc) throws IOException {
// Find next page
String nextUrl = "";
// We use comic-nav-next to the find the next page
Element elem = doc.select("div.nav-next > a").first();
// If there are no more chapters to download the last chapter will link to bato.to/series/ID
if (elem == null || elem.attr("href").contains("/series/")) {
throw new IOException("No more pages");
}
String nextPage = elem.attr("href");
return Http.url("https://bato.to" + nextPage).get();
}
@Override
public List<String> getURLsFromPage(Document doc) {
List<String> result = new ArrayList<>();