1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-24 14:33:17 +02:00

Merge pull request #1417 from Pocochub/patch-1

Fix #1416 - Fails to download gfycat.com/amp/*
This commit is contained in:
cyian-1756
2019-09-09 09:03:33 -05:00
committed by GitHub
2 changed files with 20 additions and 5 deletions

View File

@@ -49,10 +49,12 @@ public class GfycatRipper extends AbstractHTMLRipper {
@Override @Override
public URL sanitizeURL(URL url) throws MalformedURLException { public URL sanitizeURL(URL url) throws MalformedURLException {
url = new URL(url.toExternalForm().replace("/gifs/detail", "")); String sUrl = url.toExternalForm();
sUrl = sUrl.replace("/gifs/detail", "");
return url; sUrl = sUrl.replace("/amp", "");
return new URL(sUrl);
} }
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());

View File

@@ -27,8 +27,21 @@ public class GfycatRipperTest extends RippersTest {
testRipper(ripper); testRipper(ripper);
} }
/**
* Rips a Gfycat profile
* @throws IOException
*/
public void testGfycatProfile() throws IOException { public void testGfycatProfile() throws IOException {
GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/@golbanstorage")); GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/@golbanstorage"));
testRipper(ripper); testRipper(ripper);
} }
/**
* Rips a Gfycat amp link
* @throws IOException
*/
public void testGfycatAmp() throws IOException {
GfycatRipper ripper = new GfycatRipper(new URL("https://gfycat.com/amp/TemptingExcellentIchthyosaurs"));
testRipper(ripper);
}
} }