1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-27 07:44:20 +02:00

Fixed gfycat ripper

This commit is contained in:
cyian-1756
2019-01-26 05:07:32 -05:00
parent 7138e5dc92
commit 4a8602faad

View File

@@ -101,14 +101,14 @@ public class GfycatRipper extends AbstractSingleFileRipper {
url = new URL(url.toExternalForm().replace("/gifs/detail", ""));
Document doc = Http.url(url).get();
Elements videos = doc.select("source");
if (videos.isEmpty()) {
throw new IOException("Could not find source at " + url);
Elements videos = doc.select("script");
for (Element el : videos) {
String json = el.html();
if (json.startsWith("{")) {
JSONObject page = new JSONObject(json);
return page.getJSONObject("video").getString("contentUrl");
}
}
String vidUrl = videos.first().attr("src");
if (vidUrl.startsWith("//")) {
vidUrl = "http:" + vidUrl;
}
return vidUrl;
throw new IOException();
}
}