Merge pull request #935 from digitalnoise/master

Mulemax.com Ripper (NSFW)
This commit is contained in:
cyian-1756 2018-09-14 07:50:21 -04:00 committed by GitHub
commit 97ed831c94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 170 additions and 0 deletions

View File

@ -0,0 +1,66 @@
package com.rarchives.ripme.ripper.rippers.video;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import com.rarchives.ripme.ripper.VideoRipper;
import com.rarchives.ripme.utils.Http;
public class MulemaxRipper extends VideoRipper {
private static final String HOST = "mulemax";
public MulemaxRipper(URL url) throws IOException {
super(url);
}
@Override
public String getHost() {
return HOST;
}
@Override
public boolean canRip(URL url) {
Pattern p = Pattern.compile("^https?://.*mulemax\\.com/video/(.*)/.*$");
Matcher m = p.matcher(url.toExternalForm());
return m.matches();
}
@Override
public URL sanitizeURL(URL url) throws MalformedURLException {
return url;
}
@Override
public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("^https?://.*mulemax\\.com/video/(.*)/(.*)$");
Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) {
return m.group(2);
}
throw new MalformedURLException(
"Expected mulemax format:"
+ "mulemax.com/video/####"
+ " Got: " + url);
}
@Override
public void rip() throws IOException {
LOGGER.info("Retrieving " + this.url);
Document doc = Http.url(url).get();
Elements videos = doc.select(".video-js > source");
if (videos.isEmpty()) {
throw new IOException("Could not find Embed code at " + url);
}
String vidUrl = videos.attr("src");
addURLToDownload(new URL(vidUrl), HOST + "_" + getGID(this.url));
waitForThreads();
}
}

View File

@ -0,0 +1,66 @@
package com.rarchives.ripme.ripper.rippers.video;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import com.rarchives.ripme.ripper.VideoRipper;
import com.rarchives.ripme.utils.Http;
public class StickyXXXRipper extends VideoRipper {
private static final String HOST = "stickyxxx";
public StickyXXXRipper(URL url) throws IOException {
super(url);
}
@Override
public String getHost() {
return HOST;
}
@Override
public boolean canRip(URL url) {
Pattern p = Pattern.compile("^https?://.*stickyxxx\\.com(/)(.*)/$");
Matcher m = p.matcher(url.toExternalForm());
return m.matches();
}
@Override
public URL sanitizeURL(URL url) throws MalformedURLException {
return url;
}
@Override
public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("^https?://.*stickyxxx\\.com(/)(.*)/$");
Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) {
return m.group(2);
}
throw new MalformedURLException(
"Expected stickyxxx format:"
+ "stickyxxx.com/####"
+ " Got: " + url);
}
@Override
public void rip() throws IOException {
LOGGER.info("Retrieving " + this.url);
Document doc = Http.url(url).get();
Elements videos = doc.select(".wp-video > video > source");
if (videos.isEmpty()) {
throw new IOException("Could not find Embed code at " + url);
}
String vidUrl = videos.attr("src");
addURLToDownload(new URL(vidUrl), HOST + "_" + getGID(this.url));
waitForThreads();
}
}

View File

@ -0,0 +1,18 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.video.MulemaxRipper;
import com.rarchives.ripme.utils.Utils;
public class MulemaxRipperTest extends RippersTest {
public void testMulemaxVideo() throws IOException {
// This test fails on the CI - possibly due to checking for a file before it's written - so we're skipping it
if (Utils.getConfigBoolean("test.run_flaky_tests", false)) {
MulemaxRipper ripper = new MulemaxRipper(new URL("https://mulemax.com/video/1720/emma-and-her-older-sissy-are-home-for-a-holiday-break")); //pick any video from the front page
testRipper(ripper);
}
}
}

View File

@ -0,0 +1,20 @@
package com.rarchives.ripme.tst.ripper.rippers;
import java.io.IOException;
import java.net.URL;
import com.rarchives.ripme.ripper.rippers.video.StickyXXXRipper;
// import com.rarchives.ripme.tst.ripper.rippers.RippersTest;
import com.rarchives.ripme.utils.Utils;
public class StickyXXXRipperTest extends RippersTest {
public void testStickyXXXVideo() throws IOException {
// This test fails on the CI - possibly due to checking for a file before it's written - so we're skipping it
if (Utils.getConfigBoolean("test.run_flaky_tests", false)) {
StickyXXXRipper ripper = new StickyXXXRipper(new URL("http://www.stickyxxx.com/a-very-intense-farewell/"));
testRipper(ripper);
}
}
}