1.1.4 - Fix deviantart 403 errors, fixes #159

This commit is contained in:
4pr0n 2015-01-25 21:12:30 -08:00
parent 3a7d6640f6
commit c2a9d680b2
3 changed files with 15 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.rarchives.ripme</groupId>
<artifactId>ripme</artifactId>
<packaging>jar</packaging>
<version>1.1.3</version>
<version>1.1.4</version>
<name>ripme</name>
<url>http://rip.rarchives.com</url>
<properties>

View File

@ -28,7 +28,8 @@ import com.rarchives.ripme.utils.Utils;
public class DeviantartRipper extends AbstractHTMLRipper {
private static final int SLEEP_TIME = 2000;
private static final int PAGE_SLEEP_TIME = 3000,
IMAGE_SLEEP_TIME = 1500;
private Map<String,String> cookies = new HashMap<String,String>();
private Set<String> triedURLs = new HashSet<String>();
@ -52,6 +53,15 @@ public class DeviantartRipper extends AbstractHTMLRipper {
@Override
public URL sanitizeURL(URL url) throws MalformedURLException {
String u = url.toExternalForm();
if (u.replace("/", "").endsWith(".deviantart.com")) {
// Root user page, get all albums
if (!u.endsWith("/")) {
u += "/";
}
u += "gallery/?";
}
String subdir = "/";
if (u.contains("catpath=scraps")) {
subdir = "scraps";
@ -166,7 +176,7 @@ public class DeviantartRipper extends AbstractHTMLRipper {
if (nextPage.startsWith("/")) {
nextPage = "http://" + this.url.getHost() + nextPage;
}
if (!sleep(SLEEP_TIME)) {
if (!sleep(PAGE_SLEEP_TIME)) {
throw new IOException("Interrupted while waiting to load next page: " + nextPage);
}
logger.info("Found next page: " + nextPage);
@ -178,6 +188,7 @@ public class DeviantartRipper extends AbstractHTMLRipper {
@Override
public void downloadURL(URL url, int index) {
addURLToDownload(url, getPrefix(index), "", this.url.toExternalForm(), cookies);
sleep(IMAGE_SLEEP_TIME);
}
/**

View File

@ -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.1.3";
private static final String DEFAULT_VERSION = "1.1.4";
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";