1.2.11 - DeviantArt fav subfolders, Reddituploads support
Allows ripping deviantart subfolders. Closes #314 Support i.reddituploads.com in RedditRipper Closes #308
This commit is contained in:
parent
23b2a398fb
commit
1105c9c170
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<groupId>com.rarchives.ripme</groupId>
|
||||
<artifactId>ripme</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.2.10</version>
|
||||
<version>1.2.11</version>
|
||||
<name>ripme</name>
|
||||
<url>http://rip.rarchives.com</url>
|
||||
<properties>
|
||||
|
@ -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()) {
|
||||
|
@ -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<URL> 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 + "-";
|
||||
|
@ -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";
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user