1.0.75 - 500px gets higher-res images #8
This commit is contained in:
parent
c7fce6a420
commit
baab27d6af
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<groupId>com.rarchives.ripme</groupId>
|
||||
<artifactId>ripme</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0.74</version>
|
||||
<version>1.0.75</version>
|
||||
<name>ripme</name>
|
||||
<url>http://rip.rarchives.com</url>
|
||||
<properties>
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.rarchives.ripme.ripper.rippers;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
@ -64,6 +65,7 @@ public class FivehundredpxRipper extends AbstractJSONRipper {
|
||||
baseURL += "/blogs/" + blogid
|
||||
+ "?feature=user"
|
||||
+ "&username=" + username
|
||||
+ "&image_size=5"
|
||||
+ "&rpp=100";
|
||||
return username + "_stories_" + blogid;
|
||||
}
|
||||
@ -89,7 +91,7 @@ public class FivehundredpxRipper extends AbstractJSONRipper {
|
||||
+ "?feature=user_favorites"
|
||||
+ "&username=" + username
|
||||
+ "&rpp=100"
|
||||
+ "&image_size=4";
|
||||
+ "&image_size=5";
|
||||
return username + "_faves";
|
||||
}
|
||||
|
||||
@ -102,8 +104,8 @@ public class FivehundredpxRipper extends AbstractJSONRipper {
|
||||
+ "?feature=user"
|
||||
+ "&username=" + username
|
||||
+ "&rpp=100"
|
||||
+ "&image_size=4";
|
||||
return username + "_faves";
|
||||
+ "&image_size=5";
|
||||
return username;
|
||||
}
|
||||
|
||||
throw new MalformedURLException(
|
||||
@ -133,6 +135,7 @@ public class FivehundredpxRipper extends AbstractJSONRipper {
|
||||
+ "?feature=user"
|
||||
+ "&username=" + username
|
||||
+ "&rpp=100"
|
||||
+ "&image_size=5"
|
||||
+ "&consumer_key=" + CONSUMER_KEY;
|
||||
logger.info("Loading " + blogURL);
|
||||
sendUpdate(STATUS.LOADING_RESOURCE, "Story ID " + blogid + " for user " + username);
|
||||
@ -174,10 +177,36 @@ public class FivehundredpxRipper extends AbstractJSONRipper {
|
||||
List<String> imageURLs = new ArrayList<String>();
|
||||
JSONArray photos = json.getJSONArray("photos");
|
||||
for (int i = 0; i < photos.length(); i++) {
|
||||
imageURLs.add(photos.getJSONObject(i).getString("image_url"));
|
||||
JSONObject photo = photos.getJSONObject(i);
|
||||
String imageURL = photo.getString("image_url");
|
||||
imageURL = imageURL.replaceAll("/4\\.", "/5.");
|
||||
// See if there's larger images
|
||||
for (String imageSize : new String[] { "2048" } ) {
|
||||
String fsURL = imageURL.replaceAll("/5\\.", "/" + imageSize + ".");
|
||||
sleep(10);
|
||||
if (urlExists(fsURL)) {
|
||||
logger.info("Found larger image at " + fsURL);
|
||||
imageURL = fsURL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
imageURLs.add(imageURL);
|
||||
}
|
||||
return imageURLs;
|
||||
}
|
||||
|
||||
private boolean urlExists(String url) {
|
||||
try {
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
|
||||
connection.setRequestMethod("HEAD");
|
||||
if (connection.getResponseCode() != 200) {
|
||||
throw new IOException("Couldn't find full-size image at " + url);
|
||||
}
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downloadURL(URL url, int index) {
|
||||
|
@ -21,7 +21,7 @@ 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.74";
|
||||
private static final String DEFAULT_VERSION = "1.0.75";
|
||||
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";
|
||||
|
Loading…
Reference in New Issue
Block a user