From cfab32d271f3afefa4e9c102070fddee268f649a Mon Sep 17 00:00:00 2001 From: Luke Payne Date: Sun, 2 Jul 2017 12:11:55 +0930 Subject: [PATCH] Updated xhamster ripper to support new URL format Fixes 4pr0n/ripme#593 Fixes ripmeapp/ripme#4 --- .../rarchives/ripme/ripper/rippers/XhamsterRipper.java | 8 ++++---- .../ripme/tst/ripper/rippers/BasicRippersTest.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/XhamsterRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/XhamsterRipper.java index 6cf986a7..490d1e28 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/XhamsterRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/XhamsterRipper.java @@ -23,7 +23,7 @@ public class XhamsterRipper extends AlbumRipper { @Override public boolean canRip(URL url) { - Pattern p = Pattern.compile("^https?://[wmde.]*xhamster\\.com/photos/gallery/[0-9]+.*$"); + Pattern p = Pattern.compile("^https?://[wmde.]*xhamster\\.com/photos/gallery/.*[0-9]+$"); Matcher m = p.matcher(url.toExternalForm()); return m.matches(); } @@ -87,14 +87,14 @@ public class XhamsterRipper extends AlbumRipper { @Override public String getGID(URL url) throws MalformedURLException { - Pattern p = Pattern.compile("^https?://([a-z0-9.]*?)xhamster\\.com/photos/gallery/([0-9]{1,})/.*\\.html"); + Pattern p = Pattern.compile("^https?://[wmde.]*xhamster\\.com/photos/gallery/.*?(\\d{1,})$"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()) { - return m.group(2); + return m.group(1); } throw new MalformedURLException( "Expected xhamster.com gallery formats: " - + "xhamster.com/photos/gallery/#####/xxxxx..html" + + "xhamster.com/photos/gallery/xxxxx-#####" + " Got: " + url); } diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java index 153288d8..b7b79f1f 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java @@ -276,7 +276,7 @@ public class BasicRippersTest extends RippersTest { } public void testXhamsterAlbums() throws IOException { - XhamsterRipper ripper = new XhamsterRipper(new URL("http://xhamster.com/photos/gallery/1462237/alyssa_gadson.html")); + XhamsterRipper ripper = new XhamsterRipper(new URL("https://xhamster.com/photos/gallery/volleyball-sluts-8305007")); testRipper(ripper); } }