Gfycat Tests & Fix for bad reddit submissions
Added sanitization, and appropriate tests. Task #361 - Some gfycat doesn't work
This commit is contained in:
parent
27e6f3fe0c
commit
8960b8a565
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user