From a50198c92403cc0ba92de7b0a2c63a52fe70169a Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Fri, 2 May 2014 23:13:31 -0700 Subject: [PATCH] Supporte old style of imgur account albums http://username.imgur.com/album_title Closes #31 --- .../ripme/ripper/rippers/ImgurRipper.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 d5a8f4bd..f534272f 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/ImgurRipper.java @@ -357,13 +357,6 @@ public class ImgurRipper extends AlbumRipper { albumType = ALBUM_TYPE.USER; return gid; } - p = Pattern.compile("^https?://([a-zA-Z0-9\\-]{3,})\\.imgur\\.com/?$"); - m = p.matcher(url.toExternalForm()); - if (m.matches()) { - // Imgur account album - albumType = ALBUM_TYPE.USER_ALBUM; - return m.group(); - } p = Pattern.compile("^https?://([a-zA-Z0-9\\-]{3,})\\.imgur\\.com/all.*$"); m = p.matcher(url.toExternalForm()); if (m.matches()) { @@ -371,6 +364,13 @@ public class ImgurRipper extends AlbumRipper { albumType = ALBUM_TYPE.USER_IMAGES; return m.group(1) + "_images"; } + p = Pattern.compile("^https?://([a-zA-Z0-9\\-]{3,})\\.imgur\\.com/([a-zA-Z0-9\\-_]+).*$"); + m = p.matcher(url.toExternalForm()); + if (m.matches()) { + // Imgur account album + albumType = ALBUM_TYPE.USER_ALBUM; + return m.group(1) + "-" + m.group(2); + } p = Pattern.compile("^https?://(www\\.)?imgur\\.com/r/([a-zA-Z0-9\\-_]{3,})(/top|/new)?(/all|/year|/month|/week)?/?$"); m = p.matcher(url.toExternalForm()); if (m.matches()) { @@ -395,7 +395,7 @@ public class ImgurRipper extends AlbumRipper { } return gid.replaceAll(",", "-"); } - throw new MalformedURLException("Unexpected URL format: " + url.toExternalForm()); + throw new MalformedURLException("Unsupported imgur URL format: " + url.toExternalForm()); } public ALBUM_TYPE getAlbumType() {