1.0.18 - added kinkyshare ripper

This commit is contained in:
4pr0n 2014-04-19 03:06:30 -07:00
parent f4f8ce7f2e
commit 8db6e2a11b
3 changed files with 85 additions and 2 deletions

View File

@ -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.17</version> <version>1.0.18</version>
<name>ripme</name> <name>ripme</name>
<url>http://rip.rarchives.com</url> <url>http://rip.rarchives.com</url>
<properties> <properties>

View File

@ -0,0 +1,83 @@
package com.rarchives.ripme.ripper.rippers;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.log4j.Logger;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import com.rarchives.ripme.ripper.AbstractRipper;
public class KinkyshareRipper extends AbstractRipper {
private static final String HOST = "kinkyshare";
private static final Logger logger = Logger.getLogger(KinkyshareRipper.class);
public KinkyshareRipper(URL url) throws IOException {
super(url);
}
@Override
public String getHost() {
return HOST;
}
/**
* Reformat given URL into the desired format (all images on single page)
*/
public URL sanitizeURL(URL url) throws MalformedURLException {
return url;
}
@Override
public String getGID(URL url) throws MalformedURLException {
Pattern p; Matcher m;
p = Pattern.compile("^.*kinkyshare.com/c/([0-9]+)/?.*$");
m = p.matcher(url.toExternalForm());
if (m.matches()) {
return m.group(1);
}
throw new MalformedURLException(
"Expected imagefap.com gallery formats: "
+ "imagefap.com/gallery.php?gid=####... or "
+ "imagefap.com/pictures/####..."
+ " Got: " + url);
}
@Override
public void rip() throws IOException {
int index = 0;
logger.info(" Retrieving " + this.url.toExternalForm());
Document albumDoc = Jsoup.connect(this.url.toExternalForm()).get();
for (Element thumb : albumDoc.select(".thumbnail > a > img")) {
if (!thumb.hasAttr("src")) {
continue;
}
String image = thumb.attr("src");
image = image.replaceAll(
"/thumbs/",
"/images/");
if (image.startsWith("/")) {
image = "http://kinkyshare.com" + image;
}
index += 1;
addURLToDownload(new URL(image), String.format("%03d_", index));
}
waitForThreads();
}
public boolean canRip(URL url) {
if (!url.toExternalForm().contains("kinkyshare.com/c/")) {
return false;
}
return true;
}
}

View File

@ -19,7 +19,7 @@ import org.jsoup.nodes.Document;
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.17"; private static final String DEFAULT_VERSION = "1.0.18";
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";