Support multi-page motherless albums
This commit is contained in:
parent
e975ae6a5c
commit
1cdec765cc
@ -47,19 +47,21 @@ public class MotherlessRipper extends AbstractRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
Pattern p = Pattern.compile("^https?://(www\\.)?motherless\\.com/G([A-Z0-9]{6,8}).*$");
|
Pattern p = Pattern.compile("^https?://(www\\.)?motherless\\.com/G([VI][A-F0-9]{6,8}).*$");
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
if (!m.matches()) {
|
if (!m.matches()) {
|
||||||
throw new MalformedURLException("Expected URL format: http://motherless.com/GXXXXXXXX");
|
throw new MalformedURLException("Expected URL format: http://motherless.com/GIXXXXXXX, got: " + url);
|
||||||
}
|
}
|
||||||
return m.group(m.groupCount());
|
return m.group(m.groupCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rip() throws IOException {
|
public void rip() throws IOException {
|
||||||
int index = 0;
|
int index = 0, page = 1;
|
||||||
logger.info(" Retrieving " + this.url.toExternalForm());
|
String nextURL = this.url.toExternalForm();
|
||||||
Document doc = Jsoup.connect(this.url.toExternalForm())
|
while (nextURL != null) {
|
||||||
|
logger.info(" Retrieving " + nextURL);
|
||||||
|
Document doc = Jsoup.connect(nextURL)
|
||||||
.userAgent(USER_AGENT)
|
.userAgent(USER_AGENT)
|
||||||
.get();
|
.get();
|
||||||
for (Element thumb : doc.select("div.thumb a.img-container")) {
|
for (Element thumb : doc.select("div.thumb a.img-container")) {
|
||||||
@ -69,6 +71,13 @@ public class MotherlessRipper extends AbstractRipper {
|
|||||||
MotherlessImageThread mit = new MotherlessImageThread(url, index);
|
MotherlessImageThread mit = new MotherlessImageThread(url, index);
|
||||||
motherlessThreadPool.addThread(mit);
|
motherlessThreadPool.addThread(mit);
|
||||||
}
|
}
|
||||||
|
// Next page
|
||||||
|
nextURL = null;
|
||||||
|
page++;
|
||||||
|
if (doc.html().contains("?page=" + page)) {
|
||||||
|
nextURL = this.url.toExternalForm() + "?page=" + page;
|
||||||
|
}
|
||||||
|
}
|
||||||
motherlessThreadPool.waitForThreads();
|
motherlessThreadPool.waitForThreads();
|
||||||
waitForThreads();
|
waitForThreads();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user