diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java index 0be42535..8cac12ba 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java @@ -138,9 +138,15 @@ public class InstagramRipper extends AbstractJSONRipper { private String getMedia(JSONObject data) { String imageURL = ""; if (data.has("videos")) { - imageURL = data.getJSONObject("videos").getJSONObject("standard_resolution").getString("url"); + JSONObject videosObject = data.getJSONObject("videos"); + if (!videosObject.isNull("standard_resolution")) { + imageURL = videosObject.getJSONObject("standard_resolution").getString("url"); + } } else if (data.has("images")) { - imageURL = data.getJSONObject("images").getJSONObject("standard_resolution").getString("url"); + JSONObject imagesObject = data.getJSONObject("images"); + if (!imagesObject.isNull("standard_resolution")) { + imageURL = imagesObject.getJSONObject("standard_resolution").getString("url"); + } } return imageURL; } @@ -158,14 +164,14 @@ public class InstagramRipper extends AbstractJSONRipper { for (int carouselIndex = 0; carouselIndex < carouselMedias.length(); carouselIndex++) { JSONObject carouselMedia = (JSONObject) carouselMedias.get(carouselIndex); String imageURL = getMedia(carouselMedia); - if (!imageURL.equals("")) { + if (!"".equals(imageURL)) { imageURL = getOriginalUrl(imageURL); imageURLs.add(imageURL); } } } else { String imageURL = getMedia(data); - if (!imageURL.equals("")) { + if (!"".equals(imageURL)) { imageURL = getOriginalUrl(imageURL); imageURLs.add(imageURL); }