Support multi-page motherless albums
This commit is contained in:
parent
e975ae6a5c
commit
1cdec765cc
@ -47,27 +47,36 @@ 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) {
|
||||||
.userAgent(USER_AGENT)
|
logger.info(" Retrieving " + nextURL);
|
||||||
.get();
|
Document doc = Jsoup.connect(nextURL)
|
||||||
for (Element thumb : doc.select("div.thumb a.img-container")) {
|
.userAgent(USER_AGENT)
|
||||||
URL url = new URL("http://" + DOMAIN + thumb.attr("href"));
|
.get();
|
||||||
index += 1;
|
for (Element thumb : doc.select("div.thumb a.img-container")) {
|
||||||
// Create thread for finding image at "url" page
|
URL url = new URL("http://" + DOMAIN + thumb.attr("href"));
|
||||||
MotherlessImageThread mit = new MotherlessImageThread(url, index);
|
index += 1;
|
||||||
motherlessThreadPool.addThread(mit);
|
// Create thread for finding image at "url" page
|
||||||
|
MotherlessImageThread mit = new MotherlessImageThread(url, index);
|
||||||
|
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