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:
@@ -32,6 +32,8 @@ public class GfycatRipper extends VideoRipper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL sanitizeURL(URL url) throws MalformedURLException {
|
public URL sanitizeURL(URL url) throws MalformedURLException {
|
||||||
|
url = new URL(url.toExternalForm().replace("/gifs/detail", ""));
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +66,10 @@ public class GfycatRipper extends VideoRipper {
|
|||||||
*/
|
*/
|
||||||
public static String getVideoURL(URL url) throws IOException {
|
public static String getVideoURL(URL url) throws IOException {
|
||||||
logger.info("Retrieving " + url.toExternalForm());
|
logger.info("Retrieving " + url.toExternalForm());
|
||||||
|
|
||||||
|
//Sanitize the URL first
|
||||||
|
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#mp4Source");
|
Elements videos = doc.select("source#mp4Source");
|
||||||
if (videos.size() == 0) {
|
if (videos.size() == 0) {
|
||||||
|
Reference in New Issue
Block a user