1
0
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:
cyian-1756
2021-04-26 05:22:25 +00:00
committed by GitHub
2 changed files with 12 additions and 3 deletions

View File

@@ -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: "

View File

@@ -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);
}
}