mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-25 23:06:22 +02:00
Fixed #1795 and added new test
This commit is contained in:
@@ -57,7 +57,7 @@ public class GfycatRipper extends AbstractHTMLRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isProfile() {
|
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());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
return m.matches();
|
return m.matches();
|
||||||
}
|
}
|
||||||
@@ -79,11 +79,11 @@ public class GfycatRipper extends AbstractHTMLRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGID(URL url) throws MalformedURLException {
|
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());
|
Matcher m = p.matcher(url.toExternalForm());
|
||||||
|
|
||||||
if (m.matches())
|
if (m.matches())
|
||||||
return m.group(2);
|
return m.group(1);
|
||||||
|
|
||||||
throw new MalformedURLException(
|
throw new MalformedURLException(
|
||||||
"Expected gfycat.com format: "
|
"Expected gfycat.com format: "
|
||||||
|
@@ -44,4 +44,13 @@ public class GfycatRipperTest extends RippersTest {
|
|||||||
GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/amp/TemptingExcellentIchthyosaurs"));
|
GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/amp/TemptingExcellentIchthyosaurs"));
|
||||||
testRipper(ripper);
|
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