mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-24 14:33:17 +02:00
Merge pull request #1818 from PaaaulZ/fix-1795
Fixed #1795 and added new test
This commit is contained in:
@@ -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: "
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user