1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-22 21:43:06 +02:00

Added check if login URL results in 404 for development purpose

This commit is contained in:
MrPlaygon
2019-04-04 20:12:41 +02:00
parent 3781737786
commit ed2082dfe8

View File

@@ -207,7 +207,7 @@ public class DeviantartRipper extends AbstractHTMLRipper {
Utils.setConfigString(utilsKey, serialize(new HashMap<String, String>(getDACookie())));
Utils.saveConfig(); // save now because of other instances that might work simultaneously
}else {
} else {
LOGGER.info("No new Login needed");
}
@@ -394,6 +394,7 @@ public class DeviantartRipper extends AbstractHTMLRipper {
/**
* Updates cookies
*
* @param m new Cookies
*/
private void updateCookie(Map<String, String> m) {
@@ -402,7 +403,7 @@ public class DeviantartRipper extends AbstractHTMLRipper {
while (iter.hasNext()) {
String current = iter.next();
if (!this.allowedCookies.contains(current)) {
//m.remove(current);
// m.remove(current);
iter.remove();
}
}
@@ -421,7 +422,6 @@ public class DeviantartRipper extends AbstractHTMLRipper {
e.printStackTrace();
}
}
/**
@@ -564,13 +564,14 @@ public class DeviantartRipper extends AbstractHTMLRipper {
.followRedirects(true).execute();
URL location = download.url();
System.out.println("----------------> " + url);
String[] filetypePart = download.header("Content-Disposition").split("\\.");
LOGGER.info("Found Image URL");
LOGGER.info(url);
LOGGER.info(location);
addURLToDownload(location, "", "", "", new HashMap<String, String>(),
addURLToDownload(location, "", "", "", getDACookie(),
title + "." + filetypePart[filetypePart.length - 1]);
return;
}
@@ -614,7 +615,14 @@ public class DeviantartRipper extends AbstractHTMLRipper {
LOGGER.info("Found Image URL");
LOGGER.info(url);
LOGGER.info(parts[0]);
while (Http.url(parts[0]).connection().execute().statusCode() == 404) {
try {
LOGGER.error("404 on " + url);
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}
}
addURLToDownload(new URL(parts[0]), "", "", "", new HashMap<String, String>(),
title + "." + tmpParts[tmpParts.length - 1]);
return;