diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/video/XhamsterRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/video/XhamsterRipper.java index e559ebec..b30f5a1a 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/video/XhamsterRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/video/XhamsterRipper.java @@ -39,10 +39,10 @@ public class XhamsterRipper extends VideoRipper { @Override public String getGID(URL url) throws MalformedURLException { - Pattern p = Pattern.compile("^https?://.*xhamster\\.com/(movies|videos)/.*$"); + Pattern p = Pattern.compile("^https?://.*xhamster\\.com/(movies|videos)/(.*)$"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()) { - return m.group(1); + return m.group(2); } throw new MalformedURLException( @@ -56,7 +56,7 @@ public class XhamsterRipper extends VideoRipper { public void rip() throws IOException { logger.info("Retrieving " + this.url); Document doc = Http.url(url).get(); - Elements videos = doc.select("a.mp4Thumb"); + Elements videos = doc.select("div.player-container > a"); if (videos.size() == 0) { throw new IOException("Could not find Embed code at " + url); } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java index 73c818d0..f4566c11 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java @@ -8,6 +8,7 @@ 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.VineRipper; +import com.rarchives.ripme.ripper.rippers.video.XhamsterRipper; import com.rarchives.ripme.ripper.rippers.video.XvideosRipper; import com.rarchives.ripme.ripper.rippers.video.YoupornRipper; @@ -35,6 +36,15 @@ public class VideoRippersTest extends RippersTest { } } + public void testXhamsterRipper() throws IOException { + List 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 testXvideosRipper() throws IOException { List contentURLs = new ArrayList<>(); contentURLs.add(new URL("https://www.xvideos.com/video19719109/ziggy_star_ultra_hard_anal_pounding"));