Port MulemaxRipper to AbstractSingleFileRipper
This commit is contained in:
parent
b2097c74fe
commit
909af2de2c
@ -1,18 +1,22 @@
|
|||||||
package com.rarchives.ripme.ripper.rippers.video;
|
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 com.rarchives.ripme.ripper.AbstractSingleFileRipper;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
import org.jsoup.select.Elements;
|
import org.jsoup.select.Elements;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.VideoRipper;
|
import com.rarchives.ripme.ripper.VideoRipper;
|
||||||
import com.rarchives.ripme.utils.Http;
|
import com.rarchives.ripme.utils.Http;
|
||||||
|
|
||||||
public class MulemaxRipper extends VideoRipper {
|
public class MulemaxRipper extends AbstractSingleFileRipper {
|
||||||
|
|
||||||
private static final String HOST = "mulemax";
|
private static final String HOST = "mulemax";
|
||||||
|
|
||||||
@ -22,7 +26,17 @@ public class MulemaxRipper extends VideoRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
return HOST;
|
return "mulemax";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDomain() {
|
||||||
|
return "mulemax.com";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Document getFirstPage() throws IOException {
|
||||||
|
return Http.url(url).get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -52,15 +66,14 @@ public class MulemaxRipper extends VideoRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void rip() throws IOException {
|
public List<String> getURLsFromPage(Document doc) {
|
||||||
LOGGER.info("Retrieving " + this.url);
|
List<String> result = new ArrayList<>();
|
||||||
Document doc = Http.url(url).get();
|
result.add(doc.select(".video-js > source").attr("src"));
|
||||||
Elements videos = doc.select(".video-js > source");
|
return result;
|
||||||
if (videos.isEmpty()) {
|
}
|
||||||
throw new IOException("Could not find Embed code at " + url);
|
|
||||||
}
|
@Override
|
||||||
String vidUrl = videos.attr("src");
|
public void downloadURL(URL url, int index) {
|
||||||
addURLToDownload(new URL(vidUrl), HOST + "_" + getGID(this.url));
|
addURLToDownload(url, getPrefix(index));
|
||||||
waitForThreads();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,16 +3,14 @@ package com.rarchives.ripme.tst.ripper.rippers;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.rippers.video.MulemaxRipper;
|
import com.rarchives.ripme.ripper.rippers.MulemaxRipper;
|
||||||
import com.rarchives.ripme.utils.Utils;
|
import com.rarchives.ripme.utils.Utils;
|
||||||
|
|
||||||
public class MulemaxRipperTest extends RippersTest {
|
public class MulemaxRipperTest extends RippersTest {
|
||||||
|
|
||||||
public void testMulemaxVideo() throws IOException {
|
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
|
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
|
||||||
if (Utils.getConfigBoolean("test.run_flaky_tests", false)) {
|
testRipper(ripper);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user