Skip to content

Commit

Permalink
1.0.18 - added kinkyshare ripper
Browse files Browse the repository at this point in the history
  • Loading branch information
4pr0n committed Apr 19, 2014
1 parent f4f8ce7 commit 8db6e2a
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.rarchives.ripme</groupId>
<artifactId>ripme</artifactId>
<packaging>jar</packaging>
<version>1.0.17</version>
<version>1.0.18</version>
<name>ripme</name>
<url>http://rip.rarchives.com</url>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}

}
2 changes: 1 addition & 1 deletion src/main/java/com/rarchives/ripme/ui/UpdateUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class UpdateUtils {

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 updateJarURL = "http://rarchives.com/ripme.jar";
private static final String mainFileName = "ripme.jar";
Expand Down

0 comments on commit 8db6e2a

Please sign in to comment.