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:
@@ -10,7 +10,11 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.rarchives.ripme.ripper.AbstractSingleFileRipper;
|
import com.rarchives.ripme.ripper.AbstractSingleFileRipper;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
import org.jsoup.nodes.Document;
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
import org.jsoup.select.Elements;
|
import org.jsoup.select.Elements;
|
||||||
|
|
||||||
import com.rarchives.ripme.utils.Http;
|
import com.rarchives.ripme.utils.Http;
|
||||||
@@ -73,12 +77,14 @@ public class GfycatRipper extends AbstractSingleFileRipper {
|
|||||||
@Override
|
@Override
|
||||||
public List<String> getURLsFromPage(Document doc) {
|
public List<String> getURLsFromPage(Document doc) {
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
Elements videos = doc.select("source");
|
Elements videos = doc.select("script");
|
||||||
String vidUrl = videos.first().attr("src");
|
for (Element el : videos) {
|
||||||
if (vidUrl.startsWith("//")) {
|
String json = el.html();
|
||||||
vidUrl = "http:" + vidUrl;
|
if (json.startsWith("{")) {
|
||||||
|
JSONObject page = new JSONObject(json);
|
||||||
|
result.add(page.getJSONObject("video").getString("contentUrl"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
result.add(vidUrl);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user