mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-24 14:33:17 +02:00
Added non-capturing groups and simplified replacements
This commit is contained in:
@@ -29,7 +29,7 @@ public class TumblrRipper extends AlbumRipper {
|
|||||||
|
|
||||||
private static final String DOMAIN = "tumblr.com",
|
private static final String DOMAIN = "tumblr.com",
|
||||||
HOST = "tumblr",
|
HOST = "tumblr",
|
||||||
IMAGE_PATTERN = "([^\\s]+(\\.(?i)(jpg|png|gif|bmp))$)";
|
IMAGE_PATTERN = "([^\\s]+(\\.(?i)(?:jpg|png|gif|bmp))$)";
|
||||||
|
|
||||||
private enum ALBUM_TYPE {
|
private enum ALBUM_TYPE {
|
||||||
SUBDOMAIN,
|
SUBDOMAIN,
|
||||||
@@ -262,9 +262,7 @@ public class TumblrRipper extends AlbumRipper {
|
|||||||
try {
|
try {
|
||||||
fileLocation = photo.getJSONObject("original_size").getString("url").replaceAll("http:", "https:");
|
fileLocation = photo.getJSONObject("original_size").getString("url").replaceAll("http:", "https:");
|
||||||
qualM = qualP.matcher(fileLocation);
|
qualM = qualP.matcher(fileLocation);
|
||||||
if (qualM.matches()) {
|
fileLocation = qualM.replaceFirst("_1280.$1");
|
||||||
fileLocation = fileLocation.replaceFirst("_[0-9]+\\.(jpg|png|gif|bmp)$", "_1280." + qualM.group(1));
|
|
||||||
}
|
|
||||||
fileURL = new URL(fileLocation);
|
fileURL = new URL(fileLocation);
|
||||||
|
|
||||||
m = p.matcher(fileURL.toString());
|
m = p.matcher(fileURL.toString());
|
||||||
@@ -294,9 +292,7 @@ public class TumblrRipper extends AlbumRipper {
|
|||||||
// Set maximum quality, tumblr doesn't go any further
|
// Set maximum quality, tumblr doesn't go any further
|
||||||
// If the image is any smaller, it will still get the largest available size
|
// If the image is any smaller, it will still get the largest available size
|
||||||
qualM = qualP.matcher(imgSrc);
|
qualM = qualP.matcher(imgSrc);
|
||||||
if (qualM.matches()) {
|
imgSrc = qualM.replaceFirst("_1280.$1");
|
||||||
imgSrc = imgSrc.replaceFirst("_[0-9]+\\.(jpg|png|gif|bmp)$", "_1280." + qualM.group(1));
|
|
||||||
}
|
|
||||||
downloadURL(new URL(imgSrc), date);
|
downloadURL(new URL(imgSrc), date);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
LOGGER.error("[!] Error while getting embedded image at " + post, e);
|
LOGGER.error("[!] Error while getting embedded image at " + post, e);
|
||||||
|
Reference in New Issue
Block a user