mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-28 08:10:11 +02:00
Fixed gfycat ripper
This commit is contained in:
@@ -101,14 +101,14 @@ public class GfycatRipper extends AbstractSingleFileRipper {
|
|||||||
url = new URL(url.toExternalForm().replace("/gifs/detail", ""));
|
url = new URL(url.toExternalForm().replace("/gifs/detail", ""));
|
||||||
|
|
||||||
Document doc = Http.url(url).get();
|
Document doc = Http.url(url).get();
|
||||||
Elements videos = doc.select("source");
|
Elements videos = doc.select("script");
|
||||||
if (videos.isEmpty()) {
|
for (Element el : videos) {
|
||||||
throw new IOException("Could not find source at " + url);
|
String json = el.html();
|
||||||
|
if (json.startsWith("{")) {
|
||||||
|
JSONObject page = new JSONObject(json);
|
||||||
|
return page.getJSONObject("video").getString("contentUrl");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String vidUrl = videos.first().attr("src");
|
throw new IOException();
|
||||||
if (vidUrl.startsWith("//")) {
|
|
||||||
vidUrl = "http:" + vidUrl;
|
|
||||||
}
|
|
||||||
return vidUrl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user