diff --git a/pom.xml b/pom.xml index 8ac24b14..4e5b550f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rarchives.ripme ripme jar - 1.2.10 + 1.2.11 ripme http://rip.rarchives.com diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java index 24155aa8..b170c2e7 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java @@ -62,11 +62,15 @@ public class DeviantartRipper extends AbstractHTMLRipper { u += "gallery/?"; } - String subdir = "/"; - if (u.contains("catpath=scraps")) { - subdir = "scraps"; + Pattern p = Pattern.compile("^https?://([a-zA-Z0-9\\-]{1,})\\.deviantart\\.com/favou?rites/([0-9]+)/*?$"); + Matcher m = p.matcher(url.toExternalForm()); + if (!m.matches()) { + String subdir = "/"; + if (u.contains("catpath=scraps")) { + subdir = "scraps"; + } + u = u.replaceAll("\\?.*", "?catpath=" + subdir); } - u = u.replaceAll("\\?.*", "?catpath=" + subdir); return new URL(u); } @@ -89,6 +93,11 @@ public class DeviantartRipper extends AbstractHTMLRipper { // Subgallery return m.group(1) + "_" + m.group(2); } + p = Pattern.compile("^https?://([a-zA-Z0-9\\-]{1,})\\.deviantart\\.com/favou?rites/([0-9]+)/.*?$"); + m = p.matcher(url.toExternalForm()); + if (m.matches()) { + return m.group(1) + "_faves_" + m.group(2); + } p = Pattern.compile("^https?://([a-zA-Z0-9\\-]{1,})\\.deviantart\\.com/favou?rites/?$"); m = p.matcher(url.toExternalForm()); if (m.matches()) { diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/RedditRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/RedditRipper.java index bfff9cbe..067e7866 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/RedditRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/RedditRipper.java @@ -1,5 +1,6 @@ package com.rarchives.ripme.ripper.rippers; +import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -188,7 +189,18 @@ public class RedditRipper extends AlbumRipper { List urls = RipUtils.getFilesFromURL(originalURL); if (urls.size() == 1) { - addURLToDownload(urls.get(0), id + "-", "", theUrl, null); + String url = urls.get(0).toExternalForm(); + Pattern p = Pattern.compile("https?://i.reddituploads.com/([a-zA-Z0-9]+)\\?.*"); + Matcher m = p.matcher(url); + if (m.matches()) { + // It's from reddituploads. Assume .jpg extension. + String savePath = this.workingDir + File.separator; + savePath += id + "-" + m.group(1) + ".jpg"; + addURLToDownload(urls.get(0), new File(savePath)); + } + else { + addURLToDownload(urls.get(0), id + "-", "", theUrl, null); + } } else if (urls.size() > 1) { for (int i = 0; i < urls.size(); i++) { String prefix = id + "-"; diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java index 8f7a4c1f..01bb99cd 100644 --- a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java +++ b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java @@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils; public class UpdateUtils { private static final Logger logger = Logger.getLogger(UpdateUtils.class); - private static final String DEFAULT_VERSION = "1.2.10"; + private static final String DEFAULT_VERSION = "1.2.11"; private static final String updateJsonURL = "http://rarchives.com/ripme.json"; private static final String updateJarURL = "http://rarchives.com/ripme.jar"; private static final String mainFileName = "ripme.jar"; diff --git a/src/main/java/com/rarchives/ripme/utils/RipUtils.java b/src/main/java/com/rarchives/ripme/utils/RipUtils.java index 65dc8a75..f21fb6cd 100644 --- a/src/main/java/com/rarchives/ripme/utils/RipUtils.java +++ b/src/main/java/com/rarchives/ripme/utils/RipUtils.java @@ -79,10 +79,22 @@ public class RipUtils { } return result; } + + Pattern p = Pattern.compile("https?://i.reddituploads.com/([a-zA-Z0-9]+)\\?.*"); + Matcher m = p.matcher(url.toExternalForm()); + if (m.matches()) { + System.out.println("URL: " + url.toExternalForm()); + String u = url.toExternalForm().replaceAll("&", "&"); + try { + result.add(new URL(u)); + } catch (MalformedURLException e) { + } + return result; + } // Direct link to image - Pattern p = Pattern.compile("(https?://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(/\\S*)\\.(jpg|jpeg|gif|png|mp4)(\\?.*)?)"); - Matcher m = p.matcher(url.toExternalForm()); + p = Pattern.compile("(https?://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(/\\S*)\\.(jpg|jpeg|gif|png|mp4)(\\?.*)?)"); + m = p.matcher(url.toExternalForm()); if (m.matches()) { try { URL singleURL = new URL(m.group(1));