1.0.51 - Deviantart rips full-size NSFW images #44
This commit is contained in:
parent
e9bee91aba
commit
f79f0cdc3c
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<groupId>com.rarchives.ripme</groupId>
|
<groupId>com.rarchives.ripme</groupId>
|
||||||
<artifactId>ripme</artifactId>
|
<artifactId>ripme</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>1.0.50</version>
|
<version>1.0.51</version>
|
||||||
<name>ripme</name>
|
<name>ripme</name>
|
||||||
<url>http://rip.rarchives.com</url>
|
<url>http://rip.rarchives.com</url>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -21,6 +21,7 @@ import org.jsoup.select.Elements;
|
|||||||
|
|
||||||
import com.rarchives.ripme.ripper.AlbumRipper;
|
import com.rarchives.ripme.ripper.AlbumRipper;
|
||||||
import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
|
import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
|
||||||
|
import com.rarchives.ripme.utils.Base64;
|
||||||
import com.rarchives.ripme.utils.Utils;
|
import com.rarchives.ripme.utils.Utils;
|
||||||
|
|
||||||
public class DeviantartRipper extends AlbumRipper {
|
public class DeviantartRipper extends AlbumRipper {
|
||||||
@ -31,6 +32,8 @@ public class DeviantartRipper extends AlbumRipper {
|
|||||||
private static final int SLEEP_TIME = 2000;
|
private static final int SLEEP_TIME = 2000;
|
||||||
private static final Logger logger = Logger.getLogger(DeviantartRipper.class);
|
private static final Logger logger = Logger.getLogger(DeviantartRipper.class);
|
||||||
|
|
||||||
|
private Map<String,String> cookies = new HashMap<String,String>();
|
||||||
|
|
||||||
public DeviantartRipper(URL url) throws IOException {
|
public DeviantartRipper(URL url) throws IOException {
|
||||||
super(url);
|
super(url);
|
||||||
}
|
}
|
||||||
@ -52,12 +55,20 @@ public class DeviantartRipper extends AlbumRipper {
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
String nextURL = this.url.toExternalForm();
|
String nextURL = this.url.toExternalForm();
|
||||||
|
|
||||||
|
// Login
|
||||||
|
try {
|
||||||
|
cookies = loginToDeviantart();
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.warn("Failed to login: ", e);
|
||||||
|
}
|
||||||
|
|
||||||
// Iterate over every page
|
// Iterate over every page
|
||||||
while (nextURL != null) {
|
while (nextURL != null) {
|
||||||
|
|
||||||
logger.info(" Retrieving " + nextURL);
|
logger.info(" Retrieving " + nextURL);
|
||||||
sendUpdate(STATUS.LOADING_RESOURCE, "Retrieving " + nextURL);
|
sendUpdate(STATUS.LOADING_RESOURCE, "Retrieving " + nextURL);
|
||||||
Document doc = Jsoup.connect(nextURL)
|
Document doc = Jsoup.connect(nextURL)
|
||||||
|
.cookies(cookies)
|
||||||
.userAgent(USER_AGENT)
|
.userAgent(USER_AGENT)
|
||||||
.get();
|
.get();
|
||||||
|
|
||||||
@ -180,16 +191,22 @@ public class DeviantartRipper extends AlbumRipper {
|
|||||||
*/
|
*/
|
||||||
public String smallToFull(String thumb, String page) {
|
public String smallToFull(String thumb, String page) {
|
||||||
try {
|
try {
|
||||||
|
// Fetch the image page
|
||||||
Response resp = Jsoup.connect(page)
|
Response resp = Jsoup.connect(page)
|
||||||
.userAgent(USER_AGENT)
|
.userAgent(USER_AGENT)
|
||||||
|
.cookies(cookies)
|
||||||
.referrer(this.url.toExternalForm())
|
.referrer(this.url.toExternalForm())
|
||||||
.method(Method.GET)
|
.method(Method.GET)
|
||||||
.execute();
|
.execute();
|
||||||
Map<String,String> cookies = resp.cookies();
|
Map<String,String> cookies = resp.cookies();
|
||||||
|
cookies.putAll(this.cookies);
|
||||||
|
|
||||||
|
// Try to find the "Download" box
|
||||||
Elements els = resp.parse().select("a.dev-page-download");
|
Elements els = resp.parse().select("a.dev-page-download");
|
||||||
if (els.size() == 0) {
|
if (els.size() == 0) {
|
||||||
throw new IOException("no download page found");
|
throw new IOException("no download page found");
|
||||||
}
|
}
|
||||||
|
// Full-size image
|
||||||
String fsimage = els.get(0).attr("href");
|
String fsimage = els.get(0).attr("href");
|
||||||
|
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
@ -198,6 +215,7 @@ public class DeviantartRipper extends AlbumRipper {
|
|||||||
imageId = imageId.substring(0, imageId.indexOf('.'));
|
imageId = imageId.substring(0, imageId.indexOf('.'));
|
||||||
prefix = String.format("%010d_", alphaToLong(imageId));
|
prefix = String.format("%010d_", alphaToLong(imageId));
|
||||||
}
|
}
|
||||||
|
// Download it
|
||||||
addURLToDownload(new URL(fsimage), prefix, "", page, cookies);
|
addURLToDownload(new URL(fsimage), prefix, "", page, cookies);
|
||||||
return null;
|
return null;
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
@ -235,15 +253,14 @@ public class DeviantartRipper extends AlbumRipper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs into deviant art. Not required to rip NSFW images.
|
* Logs into deviant art. Required to rip full-size NSFW content.
|
||||||
* @return Map of cookies containing session data.
|
* @return Map of cookies containing session data.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private Map<String, String> loginToDeviantart() throws IOException {
|
private Map<String, String> loginToDeviantart() throws IOException {
|
||||||
// Populate postData fields
|
// Populate postData fields
|
||||||
Map<String,String> postData = new HashMap<String,String>();
|
Map<String,String> postData = new HashMap<String,String>();
|
||||||
String username = Utils.getConfigString("deviantart.username", null);
|
String username = Utils.getConfigString("deviantart.username", new String(Base64.decode("Z3JhYnB5")));
|
||||||
String password = Utils.getConfigString("deviantart.password", null);
|
String password = Utils.getConfigString("deviantart.password", new String(Base64.decode("ZmFrZXJz")));
|
||||||
if (username == null || password == null) {
|
if (username == null || password == null) {
|
||||||
throw new IOException("could not find username or password in config");
|
throw new IOException("could not find username or password in config");
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils;
|
|||||||
public class UpdateUtils {
|
public class UpdateUtils {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
|
private static final Logger logger = Logger.getLogger(UpdateUtils.class);
|
||||||
private static final String DEFAULT_VERSION = "1.0.50";
|
private static final String DEFAULT_VERSION = "1.0.51";
|
||||||
private static final String updateJsonURL = "http://rarchives.com/ripme.json";
|
private static final String updateJsonURL = "http://rarchives.com/ripme.json";
|
||||||
private static final String updateJarURL = "http://rarchives.com/ripme.jar";
|
private static final String updateJarURL = "http://rarchives.com/ripme.jar";
|
||||||
private static final String mainFileName = "ripme.jar";
|
private static final String mainFileName = "ripme.jar";
|
||||||
|
Loading…
Reference in New Issue
Block a user