1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-23 22:14:06 +02:00

Gfycat Tests & Fix for bad reddit submissions

Added sanitization, and appropriate tests.
Task #361 - Some gfycat doesn't work
This commit is contained in:
Kevin Jiang
2018-01-05 17:01:49 -05:00
parent 27e6f3fe0c
commit 8960b8a565

View File

@@ -32,6 +32,8 @@ public class GfycatRipper extends VideoRipper {
@Override
public URL sanitizeURL(URL url) throws MalformedURLException {
url = new URL(url.toExternalForm().replace("/gifs/detail", ""));
return url;
}
@@ -64,6 +66,10 @@ public class GfycatRipper extends VideoRipper {
*/
public static String getVideoURL(URL url) throws IOException {
logger.info("Retrieving " + url.toExternalForm());
//Sanitize the URL first
url = new URL(url.toExternalForm().replace("/gifs/detail", ""));
Document doc = Http.url(url).get();
Elements videos = doc.select("source#mp4Source");
if (videos.size() == 0) {