Removed getnextpage; add support for quickQueue
This commit is contained in:
parent
9281766a71
commit
bb60779469
@ -38,10 +38,40 @@ public class BatoRipper extends AbstractHTMLRipper {
|
|||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return m.group(1);
|
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: " +
|
throw new MalformedURLException("Expected bato.to URL format: " +
|
||||||
"bato.to/chapter/ID - got " + url + " instead");
|
"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
|
@Override
|
||||||
public String getAlbumTitle(URL url) throws MalformedURLException {
|
public String getAlbumTitle(URL url) throws MalformedURLException {
|
||||||
try {
|
try {
|
||||||
@ -76,20 +106,6 @@ public class BatoRipper extends AbstractHTMLRipper {
|
|||||||
return Http.url(url).get();
|
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
|
@Override
|
||||||
public List<String> getURLsFromPage(Document doc) {
|
public List<String> getURLsFromPage(Document doc) {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
|
Loading…
Reference in New Issue
Block a user