diff --git a/pom.xml b/pom.xml
index 5f3013c6..2a2f7eba 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.rarchives.ripme
ripme
jar
- 1.2.5
+ 1.2.6
ripme
http://rip.rarchives.com
diff --git a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java
index 206161aa..398ee366 100644
--- a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java
+++ b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java
@@ -176,7 +176,7 @@ public abstract class AbstractRipper
* @param url
* URL being retrieved
*/
- public void retrievingSource(URL url) {
+ public void retrievingSource(String url) {
RipStatusMessage msg = new RipStatusMessage(STATUS.LOADING_RESOURCE, url);
observer.update(this, msg);
}
diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/FivehundredpxRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/FivehundredpxRipper.java
index 702b919e..3da540cb 100644
--- a/src/main/java/com/rarchives/ripme/ripper/rippers/FivehundredpxRipper.java
+++ b/src/main/java/com/rarchives/ripme/ripper/rippers/FivehundredpxRipper.java
@@ -12,6 +12,8 @@ import java.util.regex.Pattern;
import org.json.JSONArray;
import org.json.JSONObject;
+import org.jsoup.nodes.Document;
+import org.jsoup.select.Elements;
import com.rarchives.ripme.ripper.AbstractJSONRipper;
import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
@@ -184,21 +186,44 @@ public class FivehundredpxRipper extends AbstractJSONRipper {
JSONArray photos = json.getJSONArray("photos");
for (int i = 0; i < photos.length(); i++) {
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;
- }
+ String imageURL = null;
+ String rawUrl = "https://500px.com" + photo.getString("url");
+ Document doc;
+ Elements metas = new Elements();
+ try {
+ logger.debug("Loading " + rawUrl);
+ super.retrievingSource(rawUrl);
+ doc = Http.url(rawUrl).get();
+ metas = doc.select("meta[property=\"twitter:image:src\"]");
}
- imageURLs.add(imageURL);
- if (isThisATest()) {
- break;
+ catch (IOException e) {
+ logger.error("Error fetching full-size image from " + rawUrl, e);
+ }
+ if (metas.size() > 0) {
+ imageURL = metas.first().attr("content");
+ }
+ else {
+ 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;
+ }
+ }
+ }
+ if (imageURL == null) {
+ logger.error("Failed to find image for photo " + photo.toString());
+ }
+ else {
+ imageURLs.add(imageURL);
+ if (isThisATest()) {
+ break;
+ }
}
}
return imageURLs;
diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java
index bc6ce77c..ddc6dcec 100644
--- a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java
+++ b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java
@@ -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.2.5";
+ private static final String DEFAULT_VERSION = "1.2.6";
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";