pichunter ripper no longer errors out on last page

This commit is contained in:
cyian-1756 2017-11-16 14:09:03 -05:00
parent 149ab50dc1
commit fc5d4b7533

View File

@ -37,6 +37,11 @@ public class PichunterRipper extends AbstractHTMLRipper {
if (m.matches()) { if (m.matches()) {
return m.group(2); return m.group(2);
} }
p = Pattern.compile("https?://www.pichunter.com/(tags|models|sites)/([a-zA-Z0-9_-]+)/photos/\\d+/?");
m = p.matcher(url.toExternalForm());
if (m.matches()) {
return m.group(2);
}
throw new MalformedURLException("Expected pichunter URL format: " + throw new MalformedURLException("Expected pichunter URL format: " +
"pichunter.com/(tags|models|sites)/Name/ - got " + url + " instead"); "pichunter.com/(tags|models|sites)/Name/ - got " + url + " instead");
} }
@ -51,12 +56,14 @@ public class PichunterRipper extends AbstractHTMLRipper {
public Document getNextPage(Document doc) throws IOException { public Document getNextPage(Document doc) throws IOException {
// We use comic-nav-next to the find the next page // We use comic-nav-next to the find the next page
Element elem = doc.select("div.paperSpacings > ul > li.arrow").last(); Element elem = doc.select("div.paperSpacings > ul > li.arrow").last();
if (elem != null) {
String nextPage = elem.select("a").attr("href"); String nextPage = elem.select("a").attr("href");
// Some times this returns a empty string // Some times this returns a empty string
// This for stops that // This for stops that
return Http.url("http://www.pichunter.com" + nextPage).get(); return Http.url("http://www.pichunter.com" + nextPage).get();
} }
throw new IOException("No more pages");
}
@Override @Override
public List<String> getURLsFromPage(Document doc) { public List<String> getURLsFromPage(Document doc) {