mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-11 00:14:12 +02:00
Fix imgur ripper regex for gallery and album
This commit is contained in:
@@ -61,6 +61,7 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
return albumType == ALBUM_TYPE.USER;
|
return albumType == ALBUM_TYPE.USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean canRip(URL url) {
|
public boolean canRip(URL url) {
|
||||||
if (!url.getHost().endsWith(DOMAIN)) {
|
if (!url.getHost().endsWith(DOMAIN)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -74,6 +75,7 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public URL sanitizeURL(URL url) throws MalformedURLException, URISyntaxException {
|
public URL sanitizeURL(URL url) throws MalformedURLException, URISyntaxException {
|
||||||
String u = url.toExternalForm();
|
String u = url.toExternalForm();
|
||||||
if (u.indexOf('#') >= 0) {
|
if (u.indexOf('#') >= 0) {
|
||||||
@@ -85,6 +87,7 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
return new URI(u).toURL();
|
return new URI(u).toURL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAlbumTitle(URL url) throws MalformedURLException {
|
public String getAlbumTitle(URL url) throws MalformedURLException {
|
||||||
String gid = null;
|
String gid = null;
|
||||||
try {
|
try {
|
||||||
@@ -468,7 +471,7 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
Pattern p;
|
Pattern p;
|
||||||
Matcher m;
|
Matcher m;
|
||||||
|
|
||||||
p = Pattern.compile("^https?://(www\\.|m\\.)?imgur\\.com/(a|gallery)/([a-zA-Z0-9]{5,}).*$");
|
p = Pattern.compile("^https?://(?:www\\.|m\\.)?imgur\\.com/gallery/(?:(?:[a-zA-Z0-9]*/)?.*-)?([a-zA-Z0-9]+)$");
|
||||||
m = p.matcher(url.toExternalForm());
|
m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
// Imgur album or gallery
|
// Imgur album or gallery
|
||||||
@@ -477,7 +480,7 @@ public class ImgurRipper extends AlbumRipper {
|
|||||||
this.url = new URI("http://imgur.com/a/" + gid).toURL();
|
this.url = new URI("http://imgur.com/a/" + gid).toURL();
|
||||||
return gid;
|
return gid;
|
||||||
}
|
}
|
||||||
p = Pattern.compile("^https?://(www\\.|m\\.)?imgur\\.com/(a|gallery|t)/[a-zA-Z0-9]*/([a-zA-Z0-9]{5,}).*$");
|
p = Pattern.compile("^https?://(?:www\\.|m\\.)?imgur\\.com/(?:a|t)/(?:(?:[a-zA-Z0-9]*/)?.*-)?([a-zA-Z0-9]+).*$");
|
||||||
m = p.matcher(url.toExternalForm());
|
m = p.matcher(url.toExternalForm());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
// Imgur album or gallery
|
// Imgur album or gallery
|
||||||
|
Reference in New Issue
Block a user