Fixed Imgur URLs not being recognized in some cases

This commit is contained in:
Mads 2014-03-13 20:14:51 +01:00
parent e49cab1254
commit acde4ed63f

View File

@ -19,12 +19,14 @@ public class RipUtils {
List<URL> result = new ArrayList<URL>();
// Imgur album
if (url.getHost().equals("imgur.com") && url.toExternalForm().contains("imgur.com/a/")) {
if ((url.getHost().equals("m.imgur.com") || url.getHost().equals("imgur.com"))
&& url.toExternalForm().contains("imgur.com/a/")) {
try {
return ImgurRipper.getURLsFromAlbum(url);
} catch (IOException e) {
logger.error("[!] Exception while loading album " + url, e);
}
}
// Direct link to image
@ -40,6 +42,17 @@ public class RipUtils {
}
}
if(url.getHost().equals("imgur.com") ||
url.getHost().equals("m.imgur.com")){
try {
result.add(new URL(url.toExternalForm() + ".png"));
return result;
} catch (MalformedURLException ex) {
logger.error("[!] Exception while loading album " + url, ex);
}
}
logger.error("[!] Unable to rip URL: " + url);
return result;
}