Imgur: Accept /gallery/ URLs
This commit is contained in:
parent
d81dbed0f3
commit
22cee44345
@ -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()) {
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user