mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-21 13:11:27 +02:00
Removed references of AlbumRipper in the MotherlessRipper
This commit is contained in:
@@ -3,19 +3,21 @@ package com.rarchives.ripme.ripper.rippers;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
import org.jsoup.nodes.Element;
|
import org.jsoup.nodes.Element;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.AlbumRipper;
|
import com.rarchives.ripme.ripper.AbstractHTMLRipper;
|
||||||
import com.rarchives.ripme.ripper.DownloadThreadPool;
|
import com.rarchives.ripme.ripper.DownloadThreadPool;
|
||||||
import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
|
import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
|
||||||
import com.rarchives.ripme.utils.Http;
|
import com.rarchives.ripme.utils.Http;
|
||||||
import com.rarchives.ripme.utils.Utils;
|
import com.rarchives.ripme.utils.Utils;
|
||||||
|
|
||||||
public class MotherlessRipper extends AlbumRipper {
|
public class MotherlessRipper extends AbstractHTMLRipper {
|
||||||
|
|
||||||
private static final String DOMAIN = "motherless.com",
|
private static final String DOMAIN = "motherless.com",
|
||||||
HOST = "motherless";
|
HOST = "motherless";
|
||||||
@@ -37,6 +39,52 @@ public class MotherlessRipper extends AlbumRipper {
|
|||||||
return url.getHost().endsWith(DOMAIN);
|
return url.getHost().endsWith(DOMAIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getDomain() {
|
||||||
|
return DOMAIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Document getFirstPage() throws IOException {
|
||||||
|
return Http.url(url).referrer("http://motherless.com").get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getURLsFromPage(Document page) {
|
||||||
|
List<String> pageURLs = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Element thumb : page.select("div.thumb a.img-container")) {
|
||||||
|
if (isStopped()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
String thumbURL = thumb.attr("href");
|
||||||
|
if (thumbURL.contains("pornmd.com")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String url;
|
||||||
|
if (!thumbURL.startsWith("http")) {
|
||||||
|
url = "http://" + DOMAIN + thumbURL;
|
||||||
|
} else {
|
||||||
|
url = thumbURL;
|
||||||
|
}
|
||||||
|
pageURLs.add(url);
|
||||||
|
|
||||||
|
if (isThisATest()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pageURLs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void downloadURL(URL url, int index) {
|
||||||
|
// Create thread for finding image at "url" page
|
||||||
|
MotherlessImageThread mit = new MotherlessImageThread(url, index);
|
||||||
|
motherlessThreadPool.addThread(mit);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
return HOST;
|
return HOST;
|
||||||
@@ -77,37 +125,17 @@ public class MotherlessRipper extends AlbumRipper {
|
|||||||
}
|
}
|
||||||
LOGGER.info("Retrieving " + nextURL);
|
LOGGER.info("Retrieving " + nextURL);
|
||||||
sendUpdate(STATUS.LOADING_RESOURCE, nextURL);
|
sendUpdate(STATUS.LOADING_RESOURCE, nextURL);
|
||||||
Document doc = Http.url(nextURL)
|
Document doc = getFirstPage();
|
||||||
.referrer("http://motherless.com")
|
List<String> URLs = getURLsFromPage(doc);
|
||||||
.get();
|
|
||||||
for (Element thumb : doc.select("div.thumb a.img-container")) {
|
|
||||||
if (isStopped()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
String thumbURL = thumb.attr("href");
|
|
||||||
if (thumbURL.contains("pornmd.com")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
URL url;
|
|
||||||
if (!thumbURL.startsWith("http")) {
|
|
||||||
url = new URL("http://" + DOMAIN + thumbURL);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
url = new URL(thumbURL);
|
|
||||||
}
|
|
||||||
index += 1;
|
|
||||||
|
|
||||||
// Create thread for finding image at "url" page
|
for (String url: URLs) {
|
||||||
MotherlessImageThread mit = new MotherlessImageThread(url, index);
|
downloadURL(new URL(url), index);
|
||||||
motherlessThreadPool.addThread(mit);
|
index ++;
|
||||||
|
}
|
||||||
|
|
||||||
if (isThisATest()) {
|
if (isThisATest()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (isThisATest()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Next page
|
// Next page
|
||||||
nextURL = null;
|
nextURL = null;
|
||||||
page++;
|
page++;
|
||||||
|
Reference in New Issue
Block a user