1.0.34 - Anonib ripper, better updater #8
This commit is contained in:
parent
a50198c924
commit
0ff9fa667b
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<groupId>com.rarchives.ripme</groupId>
|
||||
<artifactId>ripme</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.33</version>
|
||||
<version>1.0.34</version>
|
||||
<name>ripme</name>
|
||||
<url>http://rip.rarchives.com</url>
|
||||
<properties>
|
||||
|
@ -38,6 +38,9 @@ public class ChanRipper extends AlbumRipper {
|
||||
@Override
|
||||
public boolean canRip(URL url) {
|
||||
// TODO Whitelist?
|
||||
if (url.getHost().equals("anon-ib.com")) {
|
||||
return true;
|
||||
}
|
||||
return url.getHost().contains("chan") &&
|
||||
( url.toExternalForm().contains("/res/") // Most chans
|
||||
|| url.toExternalForm().contains("/thread/")); // 4chan
|
||||
@ -53,10 +56,10 @@ public class ChanRipper extends AlbumRipper {
|
||||
|
||||
String u = url.toExternalForm();
|
||||
if (u.contains("/res/")) {
|
||||
p = Pattern.compile("^.*chan.*\\.[a-z]{2,3}/[a-zA-Z0-9]+/res/([0-9]+)(\\.html|\\.php)?.*$");
|
||||
p = Pattern.compile("^.*(chan|anon-ib).*\\.[a-z]{2,3}/[a-zA-Z0-9]+/res/([0-9]+)(\\.html|\\.php)?.*$");
|
||||
m = p.matcher(u);
|
||||
if (m.matches()) {
|
||||
return m.group(1);
|
||||
return m.group(2);
|
||||
}
|
||||
}
|
||||
else if (u.contains("/thread/")) {
|
||||
@ -91,6 +94,11 @@ public class ChanRipper extends AlbumRipper {
|
||||
logger.debug("Skipping link that does not contain /src/: " + link.attr("href"));
|
||||
continue;
|
||||
}
|
||||
if (link.attr("href").contains("=http")
|
||||
|| link.attr("href").contains("http://imgops.com/")) {
|
||||
logger.debug("Skipping link that contains '=http' or 'imgops.com': " + link.attr("href"));
|
||||
continue;
|
||||
}
|
||||
System.err.println("URL=" + link.attr("href"));
|
||||
p = Pattern.compile("^.*\\.(jpg|jpeg|png|gif)$", Pattern.CASE_INSENSITIVE);
|
||||
m = p.matcher(link.attr("href"));
|
||||
|
@ -16,10 +16,12 @@ import org.jsoup.Connection.Response;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.jsoup.nodes.Document;
|
||||
|
||||
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.0.33";
|
||||
private static final String DEFAULT_VERSION = "1.0.34";
|
||||
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";
|
||||
@ -58,6 +60,9 @@ public class UpdateUtils {
|
||||
StringBuilder changeList = new StringBuilder();
|
||||
for (int i = 0; i < jsonChangeList.length(); i++) {
|
||||
String change = jsonChangeList.getString(i);
|
||||
if (change.startsWith(UpdateUtils.getThisJarVersion() + ":")) {
|
||||
break;
|
||||
}
|
||||
changeList.append("<br> + " + change);
|
||||
}
|
||||
|
||||
@ -136,7 +141,7 @@ public class UpdateUtils {
|
||||
Response response;
|
||||
response = Jsoup.connect(updateJarURL)
|
||||
.ignoreContentType(true)
|
||||
.timeout(60000)
|
||||
.timeout(Utils.getConfigInteger("download.timeout", 60 * 1000))
|
||||
.maxBodySize(1024 * 1024 * 100)
|
||||
.execute();
|
||||
FileOutputStream out = new FileOutputStream(updateFileName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user