diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java index bfe37b3f..5bca043d 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java @@ -73,6 +73,7 @@ public class ImgurRipper extends AlbumRipper { if (u.indexOf('#') >= 0) { u = u.substring(0, u.indexOf('#')); } + u = u.replace("imgur.com/gallery/", "imgur.com/a/"); u = u.replace("https?://m\\.imgur\\.com", "http://imgur.com"); u = u.replace("https?://i\\.imgur\\.com", "http://imgur.com"); return new URL(u); @@ -370,6 +371,15 @@ public class ImgurRipper extends AlbumRipper { this.url = new URL("http://imgur.com/a/" + gid); return gid; } + p = Pattern.compile("^https?://(m\\.)?imgur\\.com/gallery/([a-zA-Z0-9]{5,8}).*$"); + m = p.matcher(url.toExternalForm()); + if (m.matches()) { + // Imgur gallery + albumType = ALBUM_TYPE.ALBUM; + String gid = m.group(m.groupCount()); + this.url = new URL("http://imgur.com/a/" + gid); + return gid; + } p = Pattern.compile("^https?://([a-zA-Z0-9\\-]{3,})\\.imgur\\.com/?$"); m = p.matcher(url.toExternalForm()); if (m.matches()) { diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImgurRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImgurRipperTest.java index 0f15cc1b..2ce9c307 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImgurRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/ImgurRipperTest.java @@ -38,9 +38,10 @@ public class ImgurRipperTest extends RippersTest { contentURLs.add(new URL("http://imgur.com/a/WxG6f/layout/vertical#0")); contentURLs.add(new URL("http://imgur.com/a/WxG6f/layout/horizontal#0")); contentURLs.add(new URL("http://imgur.com/a/WxG6f/layout/grid#0")); + contentURLs.add(new URL("http://imgur.com/gallery/FmP2o")); // Gallery URL // Sometimes hangs up //contentURLs.add(new URL("http://imgur.com/r/nsfw_oc/top/all")); - contentURLs.add(new URL("http://imgur.com/a/bXQpH")); + contentURLs.add(new URL("http://imgur.com/a/bXQpH")); // Album with titles/descriptions for (URL url : contentURLs) { ImgurRipper ripper = new ImgurRipper(url); testRipper(ripper);