Merge pull request #949 from digitalnoise/master
Ruleporn.com Ripper (NSFW)
This commit is contained in:
commit
f38ce84a58
@ -0,0 +1,59 @@
|
|||||||
|
package com.rarchives.ripme.ripper.rippers;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.rarchives.ripme.ripper.AbstractSingleFileRipper;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
|
||||||
|
import com.rarchives.ripme.utils.Http;
|
||||||
|
|
||||||
|
public class RulePornRipper extends AbstractSingleFileRipper {
|
||||||
|
|
||||||
|
public RulePornRipper(URL url) throws IOException {
|
||||||
|
super(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getHost() {
|
||||||
|
return "ruleporn";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDomain() {
|
||||||
|
return "ruleporn.com";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getGID(URL url) throws MalformedURLException {
|
||||||
|
Pattern p = Pattern.compile("^https://.*ruleporn\\.com/(.*)/$");
|
||||||
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
|
if (m.matches()) {
|
||||||
|
return m.group(1);
|
||||||
|
}
|
||||||
|
throw new MalformedURLException(
|
||||||
|
"Expected ruleporn.com URL format: " + "ruleporn.com/NAME - got " + url + " instead");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Document getFirstPage() throws IOException {
|
||||||
|
return Http.url(url).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getURLsFromPage(Document doc) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
result.add(doc.select("source[type=video/mp4]").attr("src"));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downloadURL(URL url, int index) {
|
||||||
|
addURLToDownload(url, getPrefix(index));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.rarchives.ripme.tst.ripper.rippers;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import com.rarchives.ripme.ripper.rippers.RulePornRipper;
|
||||||
|
|
||||||
|
public class RulePornRipperTest extends RippersTest {
|
||||||
|
public void testRip() throws IOException {
|
||||||
|
RulePornRipper ripper = new RulePornRipper(new URL("https://ruleporn.com/are-you-going-to-fill-my-lil-pussy-up/"));
|
||||||
|
testRipper(ripper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testGetGID() throws IOException {
|
||||||
|
URL url = new URL("https://ruleporn.com/are-you-going-to-fill-my-lil-pussy-up/");
|
||||||
|
RulePornRipper ripper = new RulePornRipper(url);
|
||||||
|
assertEquals("are-you-going-to-fill-my-lil-pussy-up", ripper.getGID(url));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user