Better integration tests, testing out TravisCI
This commit is contained in:
parent
c2a9d680b2
commit
9c964e432e
4
.travis.yml
Normal file
4
.travis.yml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
language: java
|
||||||
|
jdk:
|
||||||
|
- oraclejdk8
|
||||||
|
- oraclejdk7
|
2
pom.xml
2
pom.xml
@ -21,7 +21,7 @@
|
|||||||
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
<!-- jsoup HTML parser library @ http://jsoup.org/ -->
|
||||||
<groupId>org.jsoup</groupId>
|
<groupId>org.jsoup</groupId>
|
||||||
<artifactId>jsoup</artifactId>
|
<artifactId>jsoup</artifactId>
|
||||||
<version>1.7.3</version>
|
<version>1.8.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.json</groupId>
|
<groupId>org.json</groupId>
|
||||||
|
@ -72,11 +72,11 @@ public abstract class AbstractHTMLRipper extends AlbumRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (String imageURL : imageURLs) {
|
for (String imageURL : imageURLs) {
|
||||||
|
index += 1;
|
||||||
|
downloadURL(new URL(imageURL), index);
|
||||||
if (isStopped()) {
|
if (isStopped()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
index += 1;
|
|
||||||
downloadURL(new URL(imageURL), index);
|
|
||||||
}
|
}
|
||||||
if (hasDescriptionSupport()) {
|
if (hasDescriptionSupport()) {
|
||||||
List<String> textURLs = getDescriptionsFromPage(doc);
|
List<String> textURLs = getDescriptionsFromPage(doc);
|
||||||
|
@ -28,7 +28,7 @@ public abstract class AbstractRipper
|
|||||||
protected static final Logger logger = Logger.getLogger(AbstractRipper.class);
|
protected static final Logger logger = Logger.getLogger(AbstractRipper.class);
|
||||||
|
|
||||||
public static final String USER_AGENT =
|
public static final String USER_AGENT =
|
||||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:34.0) Gecko/20100101 Firefox/34.0";
|
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:35.0) Gecko/20100101 Firefox/35.0";
|
||||||
|
|
||||||
protected URL url;
|
protected URL url;
|
||||||
protected File workingDir;
|
protected File workingDir;
|
||||||
@ -42,6 +42,7 @@ public abstract class AbstractRipper
|
|||||||
public abstract String getGID(URL url) throws MalformedURLException;
|
public abstract String getGID(URL url) throws MalformedURLException;
|
||||||
|
|
||||||
private boolean shouldStop = false;
|
private boolean shouldStop = false;
|
||||||
|
private boolean thisIsATest = false;
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
shouldStop = true;
|
shouldStop = true;
|
||||||
@ -370,6 +371,11 @@ public abstract class AbstractRipper
|
|||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
// Thar be overloaded methods afoot
|
/** Methods for detecting when we're running a test. */
|
||||||
|
public void markAsTest() {
|
||||||
|
thisIsATest = true;
|
||||||
|
}
|
||||||
|
public boolean isThisATest() {
|
||||||
|
return thisIsATest;
|
||||||
|
}
|
||||||
}
|
}
|
@ -39,6 +39,12 @@ public abstract class AlbumRipper extends AbstractRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean addURLToDownload(URL url, File saveAs, String referrer, Map<String,String> cookies) {
|
public boolean addURLToDownload(URL url, File saveAs, String referrer, Map<String,String> cookies) {
|
||||||
|
// Only download one file if this is a test.
|
||||||
|
if (super.isThisATest() &&
|
||||||
|
(itemsPending.size() > 0 || itemsCompleted.size() > 0 || itemsErrored.size() > 0)) {
|
||||||
|
stop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!allowDuplicates()
|
if (!allowDuplicates()
|
||||||
&& ( itemsPending.containsKey(url)
|
&& ( itemsPending.containsKey(url)
|
||||||
|| itemsCompleted.containsKey(url)
|
|| itemsCompleted.containsKey(url)
|
||||||
|
@ -57,6 +57,10 @@ public abstract class VideoRipper extends AbstractRipper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (isThisATest()) {
|
||||||
|
System.err.println("TEST, download url: " + url);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
threadPool.addThread(new DownloadVideoThread(url, saveAs, this));
|
threadPool.addThread(new DownloadVideoThread(url, saveAs, this));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -45,7 +45,7 @@ public class ChanRipper extends AbstractHTMLRipper {
|
|||||||
}
|
}
|
||||||
if (chanSite == null) {
|
if (chanSite == null) {
|
||||||
chanSite = new ChanSite(Arrays.asList(url.getHost()));
|
chanSite = new ChanSite(Arrays.asList(url.getHost()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,7 +61,7 @@ public class ChanRipper extends AbstractHTMLRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRip(URL url) {
|
public boolean canRip(URL url) {
|
||||||
for (ChanSite _chanSite : explicit_domains) {
|
for (ChanSite _chanSite : explicit_domains) {
|
||||||
if (_chanSite.domains.contains(url.getHost())) {
|
if (_chanSite.domains.contains(url.getHost())) {
|
||||||
return true;
|
return true;
|
||||||
@ -70,6 +70,7 @@ public class ChanRipper extends AbstractHTMLRipper {
|
|||||||
return url.toExternalForm().contains("/res/") // Most chans
|
return url.toExternalForm().contains("/res/") // Most chans
|
||||||
|| url.toExternalForm().contains("/thread/"); // 4chan, archive.moe
|
|| url.toExternalForm().contains("/thread/"); // 4chan, archive.moe
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For example the achrives are all known. (Check 4chan-x)
|
* For example the achrives are all known. (Check 4chan-x)
|
||||||
* Should be based on the software the specific chan uses.
|
* Should be based on the software the specific chan uses.
|
||||||
@ -79,7 +80,7 @@ public class ChanRipper extends AbstractHTMLRipper {
|
|||||||
public String getGID(URL url) throws MalformedURLException {
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
Pattern p; Matcher m;
|
Pattern p; Matcher m;
|
||||||
|
|
||||||
String u = url.toExternalForm();
|
String u = url.toExternalForm();
|
||||||
if (u.contains("/thread/") || u.contains("/res/")) {
|
if (u.contains("/thread/") || u.contains("/res/")) {
|
||||||
p = Pattern.compile("^.*\\.[a-z]{1,3}/[a-zA-Z0-9]+/(thread|res)/([0-9]+)(\\.html|\\.php)?.*$");
|
p = Pattern.compile("^.*\\.[a-z]{1,3}/[a-zA-Z0-9]+/(thread|res)/([0-9]+)(\\.html|\\.php)?.*$");
|
||||||
m = p.matcher(u);
|
m = p.matcher(u);
|
||||||
|
@ -142,6 +142,11 @@ public class DeviantartRipper extends AbstractHTMLRipper {
|
|||||||
}
|
}
|
||||||
triedURLs.add(fullSize);
|
triedURLs.add(fullSize);
|
||||||
imageURLs.add(fullSize);
|
imageURLs.add(fullSize);
|
||||||
|
|
||||||
|
if (isThisATest()) {
|
||||||
|
// Only need one image for a test
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return imageURLs;
|
return imageURLs;
|
||||||
}
|
}
|
||||||
@ -164,6 +169,9 @@ public class DeviantartRipper extends AbstractHTMLRipper {
|
|||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Document getNextPage(Document page) throws IOException {
|
public Document getNextPage(Document page) throws IOException {
|
||||||
|
if (isThisATest()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Elements nextButtons = page.select("li.next > a");
|
Elements nextButtons = page.select("li.next > a");
|
||||||
if (nextButtons.size() == 0) {
|
if (nextButtons.size() == 0) {
|
||||||
throw new IOException("No next page found");
|
throw new IOException("No next page found");
|
||||||
@ -225,6 +233,9 @@ public class DeviantartRipper extends AbstractHTMLRipper {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getDescription(String page) {
|
public String getDescription(String page) {
|
||||||
|
if (isThisATest()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
// Fetch the image page
|
// Fetch the image page
|
||||||
Response resp = Http.url(page)
|
Response resp = Http.url(page)
|
||||||
|
@ -57,6 +57,7 @@ public class FineboxRipper extends AlbumRipper {
|
|||||||
if(videourl.substring(0,4)!="http"){
|
if(videourl.substring(0,4)!="http"){
|
||||||
videourl = "http://"+DOMAIN+ videourl;
|
videourl = "http://"+DOMAIN+ videourl;
|
||||||
}
|
}
|
||||||
|
logger.error("URL to download: " + videourl);
|
||||||
if(!addURLToDownload(new URL(videourl))){
|
if(!addURLToDownload(new URL(videourl))){
|
||||||
hasPagesLeft = false;
|
hasPagesLeft = false;
|
||||||
break;
|
break;
|
||||||
|
@ -17,6 +17,7 @@ import com.rarchives.ripme.utils.Http;
|
|||||||
public class ImagefapRipper extends AbstractHTMLRipper {
|
public class ImagefapRipper extends AbstractHTMLRipper {
|
||||||
|
|
||||||
private Document albumDoc = null;
|
private Document albumDoc = null;
|
||||||
|
private boolean isNewAlbumType = false;
|
||||||
|
|
||||||
public ImagefapRipper(URL url) throws IOException {
|
public ImagefapRipper(URL url) throws IOException {
|
||||||
super(url);
|
super(url);
|
||||||
@ -37,16 +38,25 @@ public class ImagefapRipper extends AbstractHTMLRipper {
|
|||||||
@Override
|
@Override
|
||||||
public URL sanitizeURL(URL url) throws MalformedURLException {
|
public URL sanitizeURL(URL url) throws MalformedURLException {
|
||||||
String gid = getGID(url);
|
String gid = getGID(url);
|
||||||
URL newURL = new URL("http://www.imagefap.com/gallery.php?gid="
|
String newURL = "http://www.imagefap.com/gallery.php?";
|
||||||
+ gid + "&view=2");
|
if (isNewAlbumType) {
|
||||||
|
newURL += "p";
|
||||||
|
}
|
||||||
|
newURL += "gid=" + gid + "&view=2";
|
||||||
logger.debug("Changed URL from " + url + " to " + newURL);
|
logger.debug("Changed URL from " + url + " to " + newURL);
|
||||||
return newURL;
|
return new URL(newURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
Pattern p; Matcher m;
|
Pattern p; Matcher m;
|
||||||
|
|
||||||
|
p = Pattern.compile("^.*imagefap.com/gallery.php\\?pgid=([a-f0-9]+).*$");
|
||||||
|
m = p.matcher(url.toExternalForm());
|
||||||
|
if (m.matches()) {
|
||||||
|
isNewAlbumType = true;
|
||||||
|
return m.group(1);
|
||||||
|
}
|
||||||
p = Pattern.compile("^.*imagefap.com/gallery.php\\?gid=([0-9]+).*$");
|
p = Pattern.compile("^.*imagefap.com/gallery.php\\?gid=([0-9]+).*$");
|
||||||
m = p.matcher(url.toExternalForm());
|
m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
@ -58,12 +68,24 @@ public class ImagefapRipper extends AbstractHTMLRipper {
|
|||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return m.group(1);
|
return m.group(1);
|
||||||
}
|
}
|
||||||
|
p = Pattern.compile("^.*imagefap.com/pictures/([a-f0-9]+).*$");
|
||||||
|
m = p.matcher(url.toExternalForm());
|
||||||
|
if (m.matches()) {
|
||||||
|
isNewAlbumType = true;
|
||||||
|
return m.group(1);
|
||||||
|
}
|
||||||
|
|
||||||
p = Pattern.compile("^.*imagefap.com/gallery/([0-9]+).*$");
|
p = Pattern.compile("^.*imagefap.com/gallery/([0-9]+).*$");
|
||||||
m = p.matcher(url.toExternalForm());
|
m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
return m.group(1);
|
return m.group(1);
|
||||||
}
|
}
|
||||||
|
p = Pattern.compile("^.*imagefap.com/gallery/([a-f0-9]+).*$");
|
||||||
|
m = p.matcher(url.toExternalForm());
|
||||||
|
if (m.matches()) {
|
||||||
|
isNewAlbumType = true;
|
||||||
|
return m.group(1);
|
||||||
|
}
|
||||||
|
|
||||||
throw new MalformedURLException(
|
throw new MalformedURLException(
|
||||||
"Expected imagefap.com gallery formats: "
|
"Expected imagefap.com gallery formats: "
|
||||||
@ -108,6 +130,9 @@ public class ImagefapRipper extends AbstractHTMLRipper {
|
|||||||
"http://x.*.fap.to/images/thumb/",
|
"http://x.*.fap.to/images/thumb/",
|
||||||
"http://fap.to/images/full/");
|
"http://fap.to/images/full/");
|
||||||
imageURLs.add(image);
|
imageURLs.add(image);
|
||||||
|
if (isThisATest()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return imageURLs;
|
return imageURLs;
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,6 @@ public class InstagramRipper extends AbstractJSONRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getUserID(URL url) throws IOException {
|
private String getUserID(URL url) throws IOException {
|
||||||
logger.info("Retrieving " + url);
|
|
||||||
this.sendUpdate(STATUS.LOADING_RESOURCE, url.toExternalForm());
|
this.sendUpdate(STATUS.LOADING_RESOURCE, url.toExternalForm());
|
||||||
Document doc = Http.url(url).get();
|
Document doc = Http.url(url).get();
|
||||||
for (Element element : doc.select("input[id=user_public]")) {
|
for (Element element : doc.select("input[id=user_public]")) {
|
||||||
|
@ -46,25 +46,6 @@ public class MotherlessRipper extends AlbumRipper {
|
|||||||
public URL sanitizeURL(URL url) throws MalformedURLException {
|
public URL sanitizeURL(URL url) throws MalformedURLException {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
@Override
|
|
||||||
public Document getFirstPage() throws IOException {
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Document getNextPage(Document doc) throws IOException {
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public List<String> getURLsFromPage(Document doc) {
|
|
||||||
List<String> imageURLs = new ArrayList<String>();
|
|
||||||
return imageURLs;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void downloadURL(URL url, int index) {
|
|
||||||
addURLToDownload(url, getPrefix(index));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
@ -115,9 +96,17 @@ public class MotherlessRipper extends AlbumRipper {
|
|||||||
url = new URL(thumbURL);
|
url = new URL(thumbURL);
|
||||||
}
|
}
|
||||||
index += 1;
|
index += 1;
|
||||||
|
|
||||||
// Create thread for finding image at "url" page
|
// Create thread for finding image at "url" page
|
||||||
MotherlessImageThread mit = new MotherlessImageThread(url, index);
|
MotherlessImageThread mit = new MotherlessImageThread(url, index);
|
||||||
motherlessThreadPool.addThread(mit);
|
motherlessThreadPool.addThread(mit);
|
||||||
|
|
||||||
|
if (isThisATest()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isThisATest()) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
// Next page
|
// Next page
|
||||||
nextURL = null;
|
nextURL = null;
|
||||||
@ -146,7 +135,7 @@ public class MotherlessRipper extends AlbumRipper {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
if (isStopped()) {
|
if (isStopped() && !isThisATest()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String u = this.url.toExternalForm();
|
String u = this.url.toExternalForm();
|
||||||
|
@ -56,7 +56,7 @@ public class SeeniveRipper extends AlbumRipper {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
String card = element.attr("href"); // "/v/<video_id>"
|
String card = element.attr("href"); // "/v/<video_id>"
|
||||||
URL videoURL = new URL("https://seenive.com" + card);
|
URL videoURL = new URL("http://seenive.com" + card);
|
||||||
SeeniveImageThread vit = new SeeniveImageThread(videoURL);
|
SeeniveImageThread vit = new SeeniveImageThread(videoURL);
|
||||||
seeniveThreadPool.addThread(vit);
|
seeniveThreadPool.addThread(vit);
|
||||||
lastID = card.substring(card.lastIndexOf('/') + 1);
|
lastID = card.substring(card.lastIndexOf('/') + 1);
|
||||||
@ -96,7 +96,7 @@ public class SeeniveRipper extends AlbumRipper {
|
|||||||
Pattern p = Pattern.compile("^https?://(www\\.)?seenive\\.com/u/([a-zA-Z0-9]{1,}).*$");
|
Pattern p = Pattern.compile("^https?://(www\\.)?seenive\\.com/u/([a-zA-Z0-9]{1,}).*$");
|
||||||
Matcher m = p.matcher(url.toExternalForm());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
if (!m.matches()) {
|
if (!m.matches()) {
|
||||||
throw new MalformedURLException("Expected format: https://seenive.com/u/USERID");
|
throw new MalformedURLException("Expected format: http://seenive.com/u/USERID");
|
||||||
}
|
}
|
||||||
return m.group(m.groupCount());
|
return m.group(m.groupCount());
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,6 @@ public class Http {
|
|||||||
connection.method(Method.GET);
|
connection.method(Method.GET);
|
||||||
connection.timeout(TIMEOUT);
|
connection.timeout(TIMEOUT);
|
||||||
connection.maxBodySize(0);
|
connection.maxBodySize(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
|
@ -35,13 +35,12 @@ public class ChanRipperTest extends RippersTest {
|
|||||||
passURLs.add(new URL("http://xchan.pw/porn/res/437.html"));
|
passURLs.add(new URL("http://xchan.pw/porn/res/437.html"));
|
||||||
passURLs.add(new URL("http://archive.moe/c/thread/2295132/"));
|
passURLs.add(new URL("http://archive.moe/c/thread/2295132/"));
|
||||||
for (URL url : passURLs) {
|
for (URL url : passURLs) {
|
||||||
try {
|
ChanRipper ripper = new ChanRipper(url);
|
||||||
ChanRipper ripper = new ChanRipper(url);
|
ripper.setup();
|
||||||
assert(ripper.canRip(url));
|
assert(ripper.canRip(url));
|
||||||
deleteDir(ripper.getWorkingDir());
|
assertNotNull("Ripper for " + url + " did not have a valid working directory.",
|
||||||
} catch (Exception e) {
|
ripper.getWorkingDir());
|
||||||
fail("Failed to instantiate ripper for " + url + " with message: "+e.toString());
|
deleteDir(ripper.getWorkingDir());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,22 +51,20 @@ public class ChanRipperTest extends RippersTest {
|
|||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
// URLs that should return more than 1 image
|
// URLs that should return more than 1 image
|
||||||
contentURLs.add(new URL("http://desuchan.net/v/res/7034.html"));
|
contentURLs.add(new URL("http://desuchan.net/v/res/7034.html"));
|
||||||
contentURLs.add(new URL("http://boards.4chan.org/r/res/12225949"));
|
|
||||||
contentURLs.add(new URL("http://boards.420chan.org/ana/res/75984.php"));
|
contentURLs.add(new URL("http://boards.420chan.org/ana/res/75984.php"));
|
||||||
contentURLs.add(new URL("http://7chan.org/gif/res/23795.html"));
|
contentURLs.add(new URL("http://archive.4plebs.org/s4s/thread/3005257/"));
|
||||||
contentURLs.add(new URL("http://unichan2.org/b/res/518004.html"));
|
|
||||||
contentURLs.add(new URL("http://xchan.pw/porn/res/437.html"));
|
// Most *chans have volatile threads & can't be trusted for integration testing.
|
||||||
contentURLs.add(new URL("http://archive.4plebs.org/hr/thread/2215899/"));
|
|
||||||
|
//contentURLs.add(new URL("http://boards.4chan.org/r/res/12225949"));
|
||||||
|
//contentURLs.add(new URL("http://7chan.org/gif/res/23795.html"));
|
||||||
|
//contentURLs.add(new URL("http://unichan2.org/b/res/518004.html"));
|
||||||
|
|
||||||
|
// xchan has an HTTPS certificaiton error...
|
||||||
|
//contentURLs.add(new URL("http://xchan.pw/porn/res/437.html"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
ChanRipper ripper = new ChanRipper(url);
|
||||||
ChanRipper ripper = new ChanRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,15 +23,8 @@ public class DeviantartRipperTest extends RippersTest {
|
|||||||
contentURLs.add(new URL("http://geekysica.deviantart.com/gallery/35209412"));
|
contentURLs.add(new URL("http://geekysica.deviantart.com/gallery/35209412"));
|
||||||
|
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
DeviantartRipper ripper = new DeviantartRipper(url);
|
||||||
DeviantartRipper ripper = new DeviantartRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,15 +18,8 @@ public class EightmusesRipperTest extends RippersTest {
|
|||||||
contentURLs.add(new URL("http://www.8muses.com/index/category/jab-hotassneighbor7"));
|
contentURLs.add(new URL("http://www.8muses.com/index/category/jab-hotassneighbor7"));
|
||||||
|
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
EightmusesRipper ripper = new EightmusesRipper(url);
|
||||||
EightmusesRipper ripper = new EightmusesRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,27 +5,24 @@ import java.net.URL;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.log4j.Level;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.rippers.FineboxRipper;
|
import com.rarchives.ripme.ripper.rippers.FineboxRipper;
|
||||||
|
|
||||||
public class FineboxRipperTest extends RippersTest {
|
public class FineboxRipperTest extends RippersTest {
|
||||||
|
|
||||||
public void testVineboxAlbums() throws IOException {
|
public void testVineboxAlbums() throws IOException {
|
||||||
if (DOWNLOAD_CONTENT) {
|
if (!DOWNLOAD_CONTENT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Logger.getRootLogger().setLevel(Level.ALL);
|
||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
contentURLs.add(new URL("http://vinebox.co/u/wi57hMjc2Ka"));
|
contentURLs.add(new URL("http://vinebox.co/u/wi57hMjc2Ka"));
|
||||||
contentURLs.add(new URL("http://finebox.co/u/wi57hMjc2Ka"));
|
contentURLs.add(new URL("http://finebox.co/u/wi57hMjc2Ka"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
FineboxRipper ripper = new FineboxRipper(url);
|
||||||
FineboxRipper ripper = new FineboxRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,17 +14,10 @@ public class GonewildRipperTest extends RippersTest {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
contentURLs.add(new URL("http://gonewild.com/u/amle69"));
|
contentURLs.add(new URL("http://gonewild.com/user/amle69"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
GonewildRipper ripper = new GonewildRipper(url);
|
||||||
GonewildRipper ripper = new GonewildRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,43 +2,29 @@ package com.rarchives.ripme.tst.ripper.rippers;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.rippers.ImagefapRipper;
|
import com.rarchives.ripme.ripper.rippers.ImagefapRipper;
|
||||||
|
|
||||||
public class ImagefapRipperTest extends RippersTest {
|
public class ImagefapRipperTest extends RippersTest {
|
||||||
|
|
||||||
public void testImagefapGID() throws IOException {
|
|
||||||
if (!DOWNLOAD_CONTENT) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Map<URL, String> testURLs = new HashMap<URL, String>();
|
|
||||||
testURLs.put(new URL("http://www.imagefap.com/pictures/4649440/Frozen-%28Elsa-and-Anna%29?view=2"), "Frozen (Elsa and Anna)");
|
|
||||||
for (URL url : testURLs.keySet()) {
|
|
||||||
ImagefapRipper ripper = new ImagefapRipper(url);
|
|
||||||
assertEquals(testURLs.get(url), ripper.getAlbumTitle(ripper.getURL()));
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testImagefapAlbums() throws IOException {
|
public void testImagefapAlbums() throws IOException {
|
||||||
if (!DOWNLOAD_CONTENT) {
|
if (!DOWNLOAD_CONTENT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<URL> contentURLs = new ArrayList<URL>();
|
Map<URL, String> testURLs = new HashMap<URL, String>();
|
||||||
contentURLs.add(new URL("http://www.imagefap.com/pictures/4649440/Frozen-%28Elsa-and-Anna%29?view=2"));
|
// Album with specific title
|
||||||
for (URL url : contentURLs) {
|
testURLs.put(new URL("http://www.imagefap.com/pictures/4649440/Frozen-%28Elsa-and-Anna%29?view=2"),
|
||||||
try {
|
"Frozen (Elsa and Anna)");
|
||||||
ImagefapRipper ripper = new ImagefapRipper(url);
|
|
||||||
ripper.rip();
|
// New URL format
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
testURLs.put(new URL("http://www.imagefap.com/gallery.php?pgid=fffd68f659befa5535cf78f014e348f1"),
|
||||||
deleteDir(ripper.getWorkingDir());
|
"imagefap_fffd68f659befa5535cf78f014e348f1");
|
||||||
} catch (Exception e) {
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
for (URL url : testURLs.keySet()) {
|
||||||
}
|
ImagefapRipper ripper = new ImagefapRipper(url);
|
||||||
|
testRipper(ripper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,59 +30,24 @@ public class ImgurRipperTest extends RippersTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testImgurURLPasses() throws IOException {
|
|
||||||
List<URL> passURLs = new ArrayList<URL>();
|
|
||||||
// Imgur URLs that should work
|
|
||||||
passURLs.add(new URL("http://imgur.com/a/XPd4F"));
|
|
||||||
passURLs.add(new URL("http://imgur.com/a/XPd4F/"));
|
|
||||||
passURLs.add(new URL("http://imgur.com/a/WxG6f/all"));
|
|
||||||
passURLs.add(new URL("http://imgur.com/a/WxG6f/layout/vertical#0"));
|
|
||||||
passURLs.add(new URL("http://imgur.com/a/WxG6f/layout/horizontal#0"));
|
|
||||||
passURLs.add(new URL("http://imgur.com/a/WxG6f/layout/grid#0"));
|
|
||||||
passURLs.add(new URL("http://imgur.com/YOdjht3,x5VxH9G,5juXjJ2"));
|
|
||||||
passURLs.add(new URL("http://markedone911.imgur.com"));
|
|
||||||
passURLs.add(new URL("http://markedone911.imgur.com/"));
|
|
||||||
passURLs.add(new URL("http://imgur.com/r/nsfw_oc/top/all"));
|
|
||||||
passURLs.add(new URL("http://imgur.com/r/nsfw_oc/top"));
|
|
||||||
passURLs.add(new URL("http://imgur.com/r/nsfw_oc/new"));
|
|
||||||
passURLs.add(new URL("http://imgur.com/r/nsfw_oc"));
|
|
||||||
|
|
||||||
for (URL url : passURLs) {
|
|
||||||
try {
|
|
||||||
ImgurRipper ripper = new ImgurRipper(url);
|
|
||||||
assert(ripper.canRip(url));
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
fail("Failed to instantiate ripper for " + url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testImgurAlbums() throws IOException {
|
public void testImgurAlbums() throws IOException {
|
||||||
if (!DOWNLOAD_CONTENT) {
|
if (!DOWNLOAD_CONTENT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
// URLs that should return more than 1 image
|
// URLs that should return more than 1 image
|
||||||
/*
|
|
||||||
contentURLs.add(new URL("http://imgur.com/a/hqJIu")); // Vertical layout
|
contentURLs.add(new URL("http://imgur.com/a/hqJIu")); // Vertical layout
|
||||||
contentURLs.add(new URL("http://imgur.com/a/dS9OQ#0")); // Horizontal layout
|
contentURLs.add(new URL("http://imgur.com/a/dS9OQ#0")); // Horizontal layout
|
||||||
contentURLs.add(new URL("http://imgur.com/a/YpsW9#0")); // Grid layout
|
contentURLs.add(new URL("http://imgur.com/a/YpsW9#0")); // Grid layout
|
||||||
contentURLs.add(new URL("http://imgur.com/a/WxG6f/layout/vertical#0"));
|
contentURLs.add(new URL("http://imgur.com/a/WxG6f/layout/vertical#0"));
|
||||||
contentURLs.add(new URL("http://imgur.com/a/WxG6f/layout/horizontal#0"));
|
contentURLs.add(new URL("http://imgur.com/a/WxG6f/layout/horizontal#0"));
|
||||||
contentURLs.add(new URL("http://imgur.com/a/WxG6f/layout/grid#0"));
|
contentURLs.add(new URL("http://imgur.com/a/WxG6f/layout/grid#0"));
|
||||||
contentURLs.add(new URL("http://imgur.com/r/nsfw_oc/top/all"));
|
// Sometimes hangs up
|
||||||
*/
|
//contentURLs.add(new URL("http://imgur.com/r/nsfw_oc/top/all"));
|
||||||
contentURLs.add(new URL("http://imgur.com/a/bXQpH"));
|
contentURLs.add(new URL("http://imgur.com/a/bXQpH"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
ImgurRipper ripper = new ImgurRipper(url);
|
||||||
ImgurRipper ripper = new ImgurRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ public class InstagramRipperTest extends RippersTest {
|
|||||||
testURLs.put(new URL("http://statigr.am/username"), "username");
|
testURLs.put(new URL("http://statigr.am/username"), "username");
|
||||||
for (URL url : testURLs.keySet()) {
|
for (URL url : testURLs.keySet()) {
|
||||||
InstagramRipper ripper = new InstagramRipper(url);
|
InstagramRipper ripper = new InstagramRipper(url);
|
||||||
|
ripper.setup();
|
||||||
assertEquals(testURLs.get(url), ripper.getGID(ripper.getURL()));
|
assertEquals(testURLs.get(url), ripper.getGID(ripper.getURL()));
|
||||||
deleteDir(ripper.getWorkingDir());
|
deleteDir(ripper.getWorkingDir());
|
||||||
}
|
}
|
||||||
@ -29,16 +30,10 @@ public class InstagramRipperTest extends RippersTest {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
contentURLs.add(new URL("http://instagram.com/feelgoodincc#"));
|
contentURLs.add(new URL("http://instagram.com/tayloralesia/"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
InstagramRipper ripper = new InstagramRipper(url);
|
||||||
InstagramRipper ripper = new InstagramRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,18 +18,12 @@ public class MotherlessRipperTest extends RippersTest {
|
|||||||
// Image album
|
// Image album
|
||||||
contentURLs.add(new URL("http://motherless.com/G4DAA18D"));
|
contentURLs.add(new URL("http://motherless.com/G4DAA18D"));
|
||||||
// Video album
|
// Video album
|
||||||
contentURLs.add(new URL("http://motherless.com/GFD0F537"));
|
// XXX: Commented out because test takes too long to download the file.
|
||||||
|
// contentURLs.add(new URL("http://motherless.com/GFD0F537"));
|
||||||
|
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
MotherlessRipper ripper = new MotherlessRipper(url);
|
||||||
MotherlessRipper ripper = new MotherlessRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,20 +14,12 @@ public class RedditRipperTest extends RippersTest {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
//contentURLs.add(new URL("http://www.reddit.com/r/nsfw_oc"));
|
contentURLs.add(new URL("http://www.reddit.com/r/nsfw_oc"));
|
||||||
//contentURLs.add(new URL("http://www.reddit.com/r/nsfw_oc/top?t=all"));
|
contentURLs.add(new URL("http://www.reddit.com/r/nsfw_oc/top?t=all"));
|
||||||
//contentURLs.add(new URL("http://www.reddit.com/u/gingerpuss"));
|
|
||||||
contentURLs.add(new URL("http://www.reddit.com/r/UnrealGirls/comments/1ziuhl/in_class_veronique_popa/"));
|
contentURLs.add(new URL("http://www.reddit.com/r/UnrealGirls/comments/1ziuhl/in_class_veronique_popa/"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
RedditRipper ripper = new RedditRipper(url);
|
||||||
RedditRipper ripper = new RedditRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,30 +1,87 @@
|
|||||||
package com.rarchives.ripme.tst.ripper.rippers;
|
package com.rarchives.ripme.tst.ripper.rippers;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.rarchives.ripme.ripper.AbstractRipper;
|
||||||
|
import com.rarchives.ripme.utils.Utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains helper methods for testing rippers.
|
||||||
|
*/
|
||||||
public class RippersTest extends TestCase {
|
public class RippersTest extends TestCase {
|
||||||
|
|
||||||
// Flag for avoiding downloading content with every unit test
|
// Flag for avoiding downloading content with every unit test
|
||||||
public final boolean DOWNLOAD_CONTENT = false;
|
public final boolean DOWNLOAD_CONTENT = true;
|
||||||
|
|
||||||
public void testNothing() {
|
public final Logger logger = Logger.getLogger(RippersTest.class);
|
||||||
// Avoid complaints about no test cases in this file.
|
|
||||||
|
/** Dummy test to make JUnit not complain */
|
||||||
|
public void test() {
|
||||||
assert(true);
|
assert(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void testRipper(AbstractRipper ripper) {
|
||||||
|
try {
|
||||||
|
Utils.setConfigInteger("page.timeout", 5 * 1000);
|
||||||
|
ripper.setup();
|
||||||
|
ripper.markAsTest();
|
||||||
|
System.err.println("Sleeping 1000ms");
|
||||||
|
Thread.sleep(1000);
|
||||||
|
ripper.rip();
|
||||||
|
for (File f : ripper.getWorkingDir().listFiles()) {
|
||||||
|
System.err.println(f.toString());
|
||||||
|
}
|
||||||
|
assertTrue("Failed to download files from " + ripper.getURL(), ripper.getWorkingDir().listFiles().length >= 1);
|
||||||
|
} catch (IOException e) {
|
||||||
|
if (e.getMessage().contains("Ripping interrupted")) {
|
||||||
|
// We expect some rips to get interrupted
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
e.printStackTrace();
|
||||||
|
fail("Failed to rip " + ripper.getURL() + " : " + e.getMessage());
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
fail("Failed to rip " + ripper.getURL() + " : " + e.getMessage());
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
deleteDir(ripper.getWorkingDir());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** File extensions that are safe to delete. */
|
||||||
|
private static final String[] SAFE_EXTENSIONS =
|
||||||
|
{"png", "jpg", "jpeg", "gif",
|
||||||
|
"mp4", "webm", "mov", "mpg", "mpeg",
|
||||||
|
"txt", "log", "php"};
|
||||||
|
|
||||||
|
/** Recursively deletes a directory */
|
||||||
protected void deleteDir(File dir) {
|
protected void deleteDir(File dir) {
|
||||||
return;
|
if (!dir.getName().contains("_")) {
|
||||||
/*
|
// All ripped albums contain an underscore
|
||||||
|
// Don't delete an album if it doesn't have an underscore
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (File f : dir.listFiles()) {
|
for (File f : dir.listFiles()) {
|
||||||
|
boolean safe = false;
|
||||||
|
for (String ext : SAFE_EXTENSIONS) {
|
||||||
|
safe |= f.getAbsolutePath().toLowerCase().endsWith("." + ext);
|
||||||
|
}
|
||||||
|
if (!safe) {
|
||||||
|
// Found a file we shouldn't delete! Stop deleting immediately.
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (f.isDirectory()) {
|
if (f.isDirectory()) {
|
||||||
deleteDir(f);
|
deleteDir(f);
|
||||||
}
|
}
|
||||||
f.delete();
|
f.delete();
|
||||||
}
|
}
|
||||||
dir.delete();
|
dir.delete();
|
||||||
//*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,15 +16,8 @@ public class SeeniveRipperTest extends RippersTest {
|
|||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
contentURLs.add(new URL("http://seenive.com/u/946491170220040192"));
|
contentURLs.add(new URL("http://seenive.com/u/946491170220040192"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
SeeniveRipper ripper = new SeeniveRipper(url);
|
||||||
SeeniveRipper ripper = new SeeniveRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,17 +16,10 @@ public class TumblrRipperTest extends RippersTest {
|
|||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
contentURLs.add(new URL("http://wrouinr.tumblr.com/archive"));
|
contentURLs.add(new URL("http://wrouinr.tumblr.com/archive"));
|
||||||
contentURLs.add(new URL("http://topinstagirls.tumblr.com/tagged/berlinskaya"));
|
contentURLs.add(new URL("http://topinstagirls.tumblr.com/tagged/berlinskaya"));
|
||||||
contentURLs.add(new URL("http://fittingroomgirls.tumblr.com/post/78268776776"));
|
contentURLs.add(new URL("http://genekellyclarkson.tumblr.com/post/86100752527/lucyannebrooks-rachaelboden-friends-goodtimes-bed-boobs"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
TumblrRipper ripper = new TumblrRipper(url);
|
||||||
TumblrRipper ripper = new TumblrRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,18 +14,11 @@ public class TwitterRipperTest extends RippersTest {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
//contentURLs.add(new URL("https://twitter.com/danngamber01/media"));
|
contentURLs.add(new URL("https://twitter.com/danngamber01/media"));
|
||||||
contentURLs.add(new URL("https://twitter.com/search?q=from%3Apurrbunny%20filter%3Aimages&src=typd"));
|
contentURLs.add(new URL("https://twitter.com/search?q=from%3Apurrbunny%20filter%3Aimages&src=typd"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
TwitterRipper ripper = new TwitterRipper(url);
|
||||||
TwitterRipper ripper = new TwitterRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,15 +21,8 @@ public class VideoRippersTest extends RippersTest {
|
|||||||
contentURLs.add(new URL("http://www.xvideos.com/video1428195/stephanie_first_time_anal"));
|
contentURLs.add(new URL("http://www.xvideos.com/video1428195/stephanie_first_time_anal"));
|
||||||
contentURLs.add(new URL("http://www.xvideos.com/video7136868/vid-20140205-wa0011"));
|
contentURLs.add(new URL("http://www.xvideos.com/video7136868/vid-20140205-wa0011"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
XvideosRipper ripper = new XvideosRipper(url);
|
||||||
XvideosRipper ripper = new XvideosRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,18 +33,11 @@ public class VideoRippersTest extends RippersTest {
|
|||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
contentURLs.add(new URL("http://www.pornhub.com/view_video.php?viewkey=993166542"));
|
contentURLs.add(new URL("http://www.pornhub.com/view_video.php?viewkey=993166542"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
PornhubRipper ripper = new PornhubRipper(url);
|
||||||
PornhubRipper ripper = new PornhubRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVineRipper() throws IOException {
|
public void testVineRipper() throws IOException {
|
||||||
if (!DOWNLOAD_CONTENT) {
|
if (!DOWNLOAD_CONTENT) {
|
||||||
return;
|
return;
|
||||||
@ -59,15 +45,8 @@ public class VideoRippersTest extends RippersTest {
|
|||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
contentURLs.add(new URL("https://vine.co/v/hiqQrP0eUZx"));
|
contentURLs.add(new URL("https://vine.co/v/hiqQrP0eUZx"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
VineRipper ripper = new VineRipper(url);
|
||||||
VineRipper ripper = new VineRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,15 +57,8 @@ public class VideoRippersTest extends RippersTest {
|
|||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
contentURLs.add(new URL("http://www.youporn.com/watch/7669155/mrs-li-amateur-69-orgasm/?from=categ"));
|
contentURLs.add(new URL("http://www.youporn.com/watch/7669155/mrs-li-amateur-69-orgasm/?from=categ"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
YoupornRipper ripper = new YoupornRipper(url);
|
||||||
YoupornRipper ripper = new YoupornRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,15 +69,8 @@ public class VideoRippersTest extends RippersTest {
|
|||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
contentURLs.add(new URL("http://beeg.com/4554321"));
|
contentURLs.add(new URL("http://beeg.com/4554321"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
BeegRipper ripper = new BeegRipper(url);
|
||||||
BeegRipper ripper = new BeegRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,18 +15,11 @@ public class VkRipperTest extends RippersTest {
|
|||||||
}
|
}
|
||||||
List<URL> contentURLs = new ArrayList<URL>();
|
List<URL> contentURLs = new ArrayList<URL>();
|
||||||
contentURLs.add(new URL("https://vk.com/album45506334_172415053"));
|
contentURLs.add(new URL("https://vk.com/album45506334_172415053"));
|
||||||
//contentURLs.add(new URL("https://vk.com/album45506334_0"));
|
contentURLs.add(new URL("https://vk.com/album45506334_0"));
|
||||||
//contentURLs.add(new URL("https://vk.com/photos45506334"));
|
contentURLs.add(new URL("https://vk.com/photos45506334"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
VkRipper ripper = new VkRipper(url);
|
||||||
VkRipper ripper = new VkRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,15 +17,8 @@ public class XhamsterRipperTest extends RippersTest {
|
|||||||
contentURLs.add(new URL("http://xhamster.com/photos/gallery/1462237/alyssa_gadson.html"));
|
contentURLs.add(new URL("http://xhamster.com/photos/gallery/1462237/alyssa_gadson.html"));
|
||||||
contentURLs.add(new URL("http://xhamster.com/photos/gallery/2941201/tableau_d_039_art_ii.html"));
|
contentURLs.add(new URL("http://xhamster.com/photos/gallery/2941201/tableau_d_039_art_ii.html"));
|
||||||
for (URL url : contentURLs) {
|
for (URL url : contentURLs) {
|
||||||
try {
|
XhamsterRipper ripper = new XhamsterRipper(url);
|
||||||
XhamsterRipper ripper = new XhamsterRipper(url);
|
testRipper(ripper);
|
||||||
ripper.rip();
|
|
||||||
assert(ripper.getWorkingDir().listFiles().length > 1);
|
|
||||||
deleteDir(ripper.getWorkingDir());
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
fail("Error while ripping URL " + url + ": " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user