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