diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatRipper.java index 37b2d5ae..c542c6dc 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/GfycatRipper.java @@ -57,7 +57,7 @@ public class GfycatRipper extends AbstractHTMLRipper { } public boolean isProfile() { - Pattern p = Pattern.compile("^https?://[wm.]*gfycat\\.com/@([a-zA-Z0-9]+).*$"); + Pattern p = Pattern.compile("^https?://[wm.]*gfycat\\.com/@([a-zA-Z0-9\\.\\-\\_]+).*$"); Matcher m = p.matcher(url.toExternalForm()); return m.matches(); } @@ -79,11 +79,11 @@ public class GfycatRipper extends AbstractHTMLRipper { @Override public String getGID(URL url) throws MalformedURLException { - Pattern p = Pattern.compile("^https?://(thumbs\\.|[wm\\.]*)gfycat\\.com/@?([a-zA-Z0-9]+).*$"); + Pattern p = Pattern.compile("^https?://(?:thumbs\\.|[wm\\.]*)gfycat\\.com/@?([a-zA-Z0-9\\.\\-\\_]+).*$"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()) - return m.group(2); + return m.group(1); throw new MalformedURLException( "Expected gfycat.com format: " diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/GfycatRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/GfycatRipperTest.java index 019350ad..39c14673 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/GfycatRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/GfycatRipperTest.java @@ -44,4 +44,13 @@ public class GfycatRipperTest extends RippersTest { GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/amp/TemptingExcellentIchthyosaurs")); testRipper(ripper); } + + /** + * Rips a Gfycat profile with special characters in username + * @throws IOException + */ + public void testGfycatSpecialChar() throws IOException { + GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/@rsss.kr")); + testRipper(ripper); + } }