Merge pull request #964 from cyian-1756/XhamsterRipperVideoPort
Removed redundant xhamster ripper
This commit is contained in:
commit
015febb548
@ -1,67 +0,0 @@
|
||||
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 XhamsterRipper extends VideoRipper {
|
||||
|
||||
private static final String HOST = "xhamster";
|
||||
|
||||
public XhamsterRipper(URL url) throws IOException {
|
||||
super(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHost() {
|
||||
return HOST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRip(URL url) {
|
||||
Pattern p = Pattern.compile("^https?://.*xhamster\\.com/(movies|videos)/.*$");
|
||||
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?://.*xhamster\\.com/(movies|videos)/(.*)$");
|
||||
Matcher m = p.matcher(url.toExternalForm());
|
||||
if (m.matches()) {
|
||||
return m.group(2);
|
||||
}
|
||||
|
||||
throw new MalformedURLException(
|
||||
"Expected xhamster format:"
|
||||
+ "xhamster.com/movies/#### or"
|
||||
+ "xhamster.com/videos/####"
|
||||
+ " Got: " + url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rip() throws IOException {
|
||||
LOGGER.info("Retrieving " + this.url);
|
||||
Document doc = Http.url(url).get();
|
||||
Elements videos = doc.select("div.player-container > a");
|
||||
if (videos.isEmpty()) {
|
||||
throw new IOException("Could not find Embed code at " + url);
|
||||
}
|
||||
String vidUrl = videos.attr("href");
|
||||
addURLToDownload(new URL(vidUrl), HOST + "_" + getGID(this.url));
|
||||
waitForThreads();
|
||||
}
|
||||
}
|
@ -7,8 +7,6 @@ import java.util.List;
|
||||
|
||||
import com.rarchives.ripme.ripper.VideoRipper;
|
||||
import com.rarchives.ripme.ripper.rippers.video.PornhubRipper;
|
||||
import com.rarchives.ripme.ripper.rippers.video.XhamsterRipper;
|
||||
import com.rarchives.ripme.ripper.rippers.XvideosRipper;
|
||||
import com.rarchives.ripme.ripper.rippers.video.YoupornRipper;
|
||||
import com.rarchives.ripme.ripper.rippers.video.YuvutuRipper;
|
||||
|
||||
@ -48,15 +46,6 @@ public class VideoRippersTest extends RippersTest {
|
||||
// }
|
||||
// }
|
||||
|
||||
public void testXhamsterRipper() throws IOException {
|
||||
List<URL> contentURLs = new ArrayList<>();
|
||||
contentURLs.add(new URL("https://xhamster.com/videos/brazzers-busty-big-booty-milf-lisa-ann-fucks-her-masseur-1492828"));
|
||||
for (URL url : contentURLs) {
|
||||
XhamsterRipper ripper = new XhamsterRipper(url);
|
||||
videoTestHelper(ripper);
|
||||
}
|
||||
}
|
||||
|
||||
public void testPornhubRipper() throws IOException {
|
||||
List<URL> contentURLs = new ArrayList<>();
|
||||
contentURLs.add(new URL("https://www.pornhub.com/view_video.php?viewkey=ph5a329fa707269"));
|
||||
|
Loading…
Reference in New Issue
Block a user