mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-23 22:14:06 +02:00
Fixes for gfycat thumbs urls.
This commit is contained in:
@@ -29,7 +29,7 @@ public class GfycatRipper extends AbstractHTMLRipper {
|
||||
|
||||
|
||||
public GfycatRipper(URL url) throws IOException {
|
||||
super(url);
|
||||
super(new URL(url.toExternalForm().split("-")[0].replace("thumbs.", "")));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,15 +76,16 @@ public class GfycatRipper extends AbstractHTMLRipper {
|
||||
|
||||
@Override
|
||||
public String getGID(URL url) throws MalformedURLException {
|
||||
Pattern p = Pattern.compile("^https?://[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(1);
|
||||
}
|
||||
|
||||
|
||||
if (m.matches())
|
||||
return m.group(2);
|
||||
|
||||
throw new MalformedURLException(
|
||||
"Expected gfycat.com format:"
|
||||
+ "gfycat.com/id"
|
||||
"Expected gfycat.com format: "
|
||||
+ "gfycat.com/id or "
|
||||
+ "thumbs.gfycat.com/id.gif"
|
||||
+ " Got: " + url);
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ public class GfycatRipper extends AbstractHTMLRipper {
|
||||
t = t.replaceAll("<html>\n" +
|
||||
" <head></head>\n" +
|
||||
" <body>", "");
|
||||
t.replaceAll("</body>\n" +
|
||||
t = t.replaceAll("</body>\n" +
|
||||
"</html>", "");
|
||||
t = t.replaceAll("\n", "");
|
||||
t = t.replaceAll("=\"\"", "");
|
||||
|
Reference in New Issue
Block a user