From 529347a5536ab2657b81d775e988df8d3584cc96 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Tue, 12 Jun 2018 16:26:23 -0400 Subject: [PATCH] Tumblr ripper no longer tries to download images in fullsize if the image doesn't support it --- .../com/rarchives/ripme/ripper/rippers/TumblrRipper.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/TumblrRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/TumblrRipper.java index b7a437b2..2760ab62 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/TumblrRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/TumblrRipper.java @@ -235,8 +235,12 @@ public class TumblrRipper extends AlbumRipper { for (int j = 0; j < photos.length(); j++) { photo = photos.getJSONObject(j); try { - if (Utils.getConfigBoolean("tumblr.get_raw_image", false)) { - String urlString = photo.getJSONObject("original_size").getString("url").replaceAll("https", "http"); + String imageUrl = photo.getJSONObject("original_size").getString("url"); + // If the url is shorter than 65 chars long we skip it because it's those images don't support grabbing them in fullsize + if (Utils.getConfigBoolean("tumblr.get_raw_image", false) && + imageUrl.replaceAll("https", "http").length() > 65) { + // We have to change the link to http because tumblr uses an invalid cert for data.tumblr.com + String urlString = imageUrl.replaceAll("https", "http"); urlString = urlString.replaceAll("https?://[a-sA-Z0-9_\\-\\.]*\\.tumblr", "http://data.tumblr"); urlString = urlString.replaceAll("_\\d+\\.", "_raw."); fileURL = new URL(urlString);